Java直接运行源代码文件,不会产生HelloWorld.class第二种方法:把模块放在D盘下,然后导入
第三种方法:新建一个模块,然后把内容复制过去
byte l = 12;
short m =l;
System.out.println(m);
char n ='a';
int reason = m+n;
System.out.println(reason);
整数相除想得到小数:
System.out.println(5/2);
System.out.println(5.0/2);
int a1 = 5;
int b1 = 2;
System.out.println(1.0*a1/b1);
System.out.println("chiikawa"+a2+'a');//chiikawa10a
System.out.println(a2+'a'+"chiikawa");//107chiikawa
int c1 = 10;
int rs = c1++;//先用c1的值计算rs,然后再加1
System.out.println(rs);//10
System.out.println(c1);//11
int d1 = 10;
int rd = ++d1;//先加1,然后用d1的值计算rd
System.out.println(rd);//11
System.out.println(d1);//11
byte x = 10;
byte y =30;
//x = x+y;//编译错误,类型不匹配
x = (byte)(x+y);
x+=y;//等价于x = (byte)(x+y);
System.out.println(x);//40
int a =99;
int b = 67;
int max = a>b?a:b;
System.out.println(max);
int i = 10;
int j = 45;
int k = 34;
int temp =i>j? i:j;
int max2 = temp>k?temp:k;
System.out.println(max2);