java总结1.0
1.public class QiangZhiZhuanHuan{
public static void main(String[] args){
int i1 = 123;
byte b = (byte)i1;//强制类型转换为byte
System.out.println("int强制类型转换为byte后的值等于"+b);
}
}
2.public class Test {
static boolean bool;
static byte by;
static char ch;
static double d;
static float f;
static int i;
static long l;
static short sh;
static String str;
public static void main(String[] args) {
System.out.println("Bool :" + bool);
System.out.println("Byte :" + by);
System.out.println("Character:" + ch);
System.out.println("Double :" + d);
System.out.println("Float :" + f);
System.out.println("Integer :" + i);
System.out.println("Long :" + l);
System.out.println("Short :" + sh);
System.out.println("String :" + str);
}
}
一:
1.对象:类的一个实例,有状态和行为
2.类:模版,描述一类对象的行为和状态
3.方法:也就是行为,所有动作都在方法中完成
4.实例变量:对象的状态由实例变量的值决定
二:注意点
1.java严格区分大小写
2.类名首字母应大写
3.方法名以小写字母开头
4.源文件名和类名相同
5.从public static void main(String[] args)开始执行程序
三:标识符
1.非关键字
2.区分大小写
3.以字母,$,下划线开头
四:修饰符
1.访问控制:public,protected,private,default
2.非访问控制:final,abstract,static,synchronized
五.变量
1.局部变量
2.静态变量(类变量)
3.非静态变量(成员变量)
六.个人注意点
1.float类型后面加F/f
2.final修饰常量
浙公网安备 33010602011771号