1
2
3
4
5
6
7
8
9
10
11
|
public class Beijing { public static void main (String arge []) { int age= 23 ; //定义int类型 long c= 2323232 ; //定义长整型 char beij= '汉' ; System.out.print(beij); boolean beijing= false ; //定义boolen System.out.println(beijing); } } //定义 |
1
2
3
4
5
6
7
8
9
10
11
|
public class Dingyi { public static void main( String args[]) { short a= 0 ; int i= 11 ; long l= 22 ; double d= 555 ; float m= 1 .9f; System.out.println(i/m*d/l); } } //运算 |
1
2
3
4
5
6
7
8
9
10
11
|
public class Iftest { public static void main( String args[]) { int i= 2 ; if (i> 1 && i< 11 ){ System.out.println( "i是位于1和11" ); } else { System.out.println( "i不是位于1和11之间" ); } } } //if语句 |
public class Switchjava { public static void main(String args[]) { char c='1'; switch (c) { case 'b': System.out.println('n'); break; case 'a': System.out.println('b'); break; default: System.out.println('d'); } } } //switch语句
出 处:https://www.cnblogs.com/leiziv5/p/7890827.html