数据类型拓展
idea下载安装
这里我是找的破解包破解的
按照教程来破解就可以了
idea使用
注释
// #单行注释
/* #多行注释
*/
固定格式
public class 文件名{
public static void main(string[]arg){
System.out.println("输出的值");
}
}
数值类型:
public class 文件名{
public static void main(string[]arg){
//整数类
byte num1 = 1; // -128-127(1个字节)
short num2 = 10000; // -32768-32768(两个字节)
int num3 = 100000; // 正负21亿(四个字节)
long num4 = 1000000000000L; //数值后需带上L(8个字节)
//浮点类
float num5 = 1.1F; //float类型要在后面加F(4个字节)
double num6 = 3.1415926;//(8个字节)
//布尔值:是非
boolean flag = true or false;
}
}
// float 有误差 有限 离散 接近但不等于
字符类
char c1 = 'a';
char c2 = '中';
System.out.println((int)c2) // 强制转换
可以输出结果
//所有的字符本质还是数字
//Unicode编码 2字节 0-65536
//转义字符
char c3 ='\u0061';
System.out.println(c3)//a
System.out.println("Hello\nword");
=====================================================
String sa = new String("hello word");
String sb = new String("hello word");
System.out.println(sa==sb);
String c = "hello word";
String d = "hello word";
System.out.println(c==d);
//输出结果
false
true
//对象 内存
//布尔值拓展
boolean flag = true
if(flag==true){}
if(flag){}
//Less is More

浙公网安备 33010602011771号