1.[修饰符] class 类名{
代码}
2.
System.out.println("这是一个java程序");
3.
public class HelloWorld{
public static void main(String[] args){
System.out.println("12");
System.out.println("1"+"2");
}
}
4.注解
1.单行注解//
2.多行注解
3.文件注解
4.1和2可以嵌套使用
2和2不可以嵌套使用
5.标识符
大小写字母,_,不能用数字开头加关键字
6.变量的定义
变量类型 变量名 [=初始值];
eg.
int x=0,y;
y=x+3;
7.变量的数据类型
8种
byte,short,int ,long
float,double
char
boolean
class
interface
数组
enum
Annotation
long num = 22000000000L;
long num1= 2003l;
float f = 123.4f;
double d1 =231243.2432134d;
double d2 = 234234.342342;
float f=1000;
double d =1000;
8.变量类型的变换
int num=4;
byte b = (byte ) num;
bytea;
int b = 298;
a=(byte)b;
byte b=3;
short a=4;
char c=5;
byte b2=(byte) (b+a+c);
9.常量
用大写表示常量
10.三元运算符
()?():()
11.
1.if(){
}
else{
}
2.switch(){
case1:
}
3.while(){
}
4.do{
}while()
5.for ( ; ; ;){
}



