JAVASE 基本
JAVAME 微缩
JAVAEE 标准
特点:面向对象
跨平台
跨平台 jvm将java文件转变为字节码文件(.class) 在多个系统中运行字节码文件
分布式
JDK 语言开发包
JRE 运行环境
JVM 虚拟机
基本数据类型: 整数:byte(1字节) short(2) int(4) long(8)
浮点:float(4) double(8)
字符串:char(2)
布尔:boolean
基本数据类型精度:
byte<short<char<int<long<float<double
设定常量:final
基本数据类型之间的转换规则
1.低精度给高精度 自动转换
2.高精度给低精度 强制转换
3.不同类型进行运算时,先将低精度转为高精度,精度一致后再进行计算
break; 跳出
continue;跳过本次循环 进入下次循环
运算符
1.算术运算符 + - * / %
2.赋值运算符 = += -= /= *=
3.比较运算符 > < >= <= ==(判断两边是否相等)
4.逻辑运算符 &&(并且 与) ||(或者) !(非 不等)
5.三目运算符 判断条件?条件满足:条件不满足
条件分支:
if (){
}else if(){
}else if(){
}else {
} switch 条件判断 非多选一
switch 数据类型 buty,short,int,char,String
switch (score / 10) {
case 9:
case 10:
System.out.println("A");
break;
case 8:
System.out.println("B");
break;
case 7:
System.out.println("C");
break;
case 6:
System.out.println("D");
break;
default:
System.out.println("E");
}
循环
1.for
for (int i = 0; i <= 10; i++) {
System.out.print(i+",");
}
System.out.println();
2.while 先判断后执行
int j = 0;
while (j <= 10) {
System.out.print(j+",");
j++;
}
System.out.println();
3.do...while 当条件不满足时会执行一次 先执行后判断
int z = 0;
do {
System.out.print(z+",");
z+=2;
} while (z <= 10);
}
}
Scanner s1=new Scanner(System.in);
while (s1.hasNext()){
// 输入的时间(出生日期)
String str1=s1.next();
189

被折叠的 条评论
为什么被折叠?



