Java中的数据类型和文字有什么区别? [英] What is the difference between data types and literals in Java?

查看:209
本文介绍了Java中的数据类型和文字有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java中数据类型和文字之间有什么区别?

What is the difference between data types and literals in Java?

推荐答案

来自Java数据类型教程

数据类型:


原语类型是语言中内置的特殊数据类型;它们不是从类创建的对象

Primitive types are special data types built into the language; they are not objects created from a class

Literal:


Literal 是源代码表示固定值;文字直接在代码中表示而不需要计算

A Literal is the source code representation of a fixed value; literals are represented directly in your code without requiring computation



boolean result = true;

boolean - is data type
true - is literal

这篇关于Java中的数据类型和文字有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆