JAVA Hello World java n public class Hello
+ JAVA的第一个程序: Hello. World. java n �public class Hello. World { public static void main(String[] args) { System. out. print("Hello World!"); } }
+ Java 的名词解释-1 n Java. EE is Java Enterprise Edition (Java企业版) n Java. Se is Java Standard Edition (Java标准版) n J 2 EE is Java 2 Enterprise Edition (Java 2企业版) 这里 Java 2 是指 jdk 1. 2 及以上的版本称呼 n J 2 Se is Java 2 Standard Edition (Java 2标准版) n J 2 ME(Java 2 Platform, Micro Edition)
+ JAVA的关键字 n abstract super double int strictfp boolean else interface break extends long switch byte final native synchronized case finally new this catch float package throw char for private throws class goto protected transient const if public Try continue implements return void default Import short volatile do instanceof static while
+ 基本类型 类型名 byte 数值范围 占用空间 1字节 缺省值 (-128)~ 127 0 short 2字节 (-32768)~ 32767 0 int 4字节 (-2147483648)~ 2147483647 0 long 8字节 (-9223372036854775808) ~ 9223372036854775807 0 float 4字节 (± 3. 40282347 E+38) ~(± 1. 40239846 E-45) double 8字节 char 2字节 boolean 1位 (± 1. 79769313486231570 E+308) ~(± 4. 94065645841246544 E 324) u 0000~uffff true或false 0. 0 F 0. 0 D 说明 整 型 浮 点 型 u 0000 字符型 false 布尔型
+ 类中的基本成员变量默认值 基本�型 默�� boolean false char null(‘u 0000’) byte (byte)0 short (short)0 int 0 long 0 L float 0, 0 f double 0. 0 d
+ 参数列表 n 某个方法接受String为其参数,则必须在调用方法的时候,使用String对象作为参数。 例如: int storage(String s){ return s. length()*2; } 其他列子: boolean flag(){return true; } double naturallog. Base(){return 2. 718; } void nothing{return; }//若返回类型为void,则return为退出方法 void nothing 2(){}
+ 打印语句 n System. out. print(“hello!”); n System. out. println(“hello!”); n System. out. printf(“hello %s %s”, “world”,”peace!“); n System. out. printf(“hello %d ,%d”, 1,2);
+ 三元操作符 n Boolean-exp? Value 0: value 1 n 例如: int i=3; int j=5; System. out. println((i>j)? i: j); 参阅例子 16
- Slides: 42