1 / 6
文档名称:

Java达内学习笔记2.doc

格式:doc   页数:6
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

Java达内学习笔记2.doc

上传人:陈晓翠 2012/3/20 文件大小:0 KB

下载得到文件列表

Java达内学习笔记2.doc

文档介绍

文档介绍:Language Elements
Comments:注释
注释对于程序本身来说没有任何意义,注释的主要作用是增加程序的可读性。
注释有三种:①://ments on one line
②:/*ments on one of more lines*/
③:/**文档化注释:ments*/(mended)
Identifiers:标识符
①Names of class,method and variable:用于类名、方法名、变量名
②Begin with character,"_" or "$":标识符不能以数字开头
③Case sensitive:大小写敏感(区分大小写)
④No length limitation:长度无限制
⑤标识符不能是Java关键字,汉字也可以做标识符,但是不建议使用(使用汉字涉及到编码问题,跨平台时回出现问题)。
⑥String是Java的一个类,类名是标识符,所以String可以做标识符。
public class Test1
{
public static void main(String [] args)
{
String String="wanghao";
String 中国="China!";
(String);
(中国);
}
}
运行结果:wanghao 中国
Keywords:关键字
The goto and const keyword are not used in the Java programming.
const 保留关键字(留儿不用)。const是从C++继承而来的,但是Java并不使用const这个关键字,由于JVM是由C++编写的,因此,虽然Java并不使用const这个关键字,但却要保留下来。和const一样goto也是保留关键字!
关键字全部用小写表示(53个)
Strictly speaking,the literals true,false,and null are not keywords but literals;however,the distinction is academic.
true,false,and null是保留字但不是关键字,只是3个值,不能用来做关键字。
There is no sizeof operator.
Primitive data types:基本数据类型
Java强数据类型只能先声明后使用。
boolean Boolean literals indicating true or false
char Stores one 16-bit unicode character
char 同时具备字符和整数的特征。
byte 8-bit integer
short 16-bit integer
int 32-bit integer
long 64-bit integer
Integer Data Types-byte,short,int and long
①Three ways to represent:Octal(8),Decimal(10),and Hexadecimal(16)