public class VarDemo {
public static void main(String [] args) {
int number;
number = 1;
System.out.println(number);
int data = 100;
System.out.println(data);
int data1 = 20,data2 = 30,data3 = 40;
System.out.println(data1);
System.out.println(data2);
System.out.println(data3);
data1 = 59;
data3 = data1 + data2;
System.out.println(data3);
long data4 = 2000L;
float data5 = 10.5f;
double data6 = 20.6;
double data7 = 0.123e4;
boolean flag = true;
System.out.println(data4);
System.out.println(data5);
System.out.println(data6);
System.out.println(data7);
System.out.println(flag);
char c1 = 'A'; //在java 中字符char 类型使用的是unicode字符编码
char c2 = '\u0041';
char c3 = 65;
System.out.println(c1);
System.out.println(c2);
System.out.println(c3);
byte i = 10;
double data8 = i;
System.out.println(data8);
data8 = 10.59;
i = (byte)data8;
System.out.println(i);
int num1 = 65;
char num2 = (char)num1;
System.out.println(num2);
}
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史