1 /**2 * Description of Class3 * 4 * @authorHasee Author5 *6 */7 Public classHello {8 /**9 * This is the main method, the entrance to the programTen * One * @paramargs input parameter, array of string type A */ - Public Static voidMain (string[] args) { - //Key Code the //Notes - -System.out.println ("Hello World"); - +String _$dd123 = "";//Defining Variables - + inti; A ati = 123; - - intm = 1, n = 2, x = 4, y = 5; - - Final DoublePAI = 3.14; - in //pai = 3.1415926; - to //i = "ddd" + -String strUserName = "Tom lives in this room"; the * System.out.println (strusername); $ Panax NotoginsengstrUserName = "Zhang San Live Here"; - the System.out.println (strusername); + A byteb =-128; the + Shorts = 2; - $ intj = 123; $ - intL = (int) 1234L;//cast, show conversion - the LongLL =b; - Wuyi floatf = 123.45F; the - DoubleD = 123.45D; Wu -F = (float) D; About $ Charc = ' a '; - - intA =C; - ASystem.out.println ("a =" +a); + the Charg = 98; - $System.out.println ("G =" + g);//ASCII code the the //UTF-8 the the Booleant =true;//1 means true, logic really - int =false;//0 = False, logical false the theSystem.out.println ("20% 7 =" + (20% 7)); About the intz = 10; the the //z++;//z = z + 1 + -System.out.println ("z =" + z++); the Bayi //z--;//z = z-1 the theSystem.out.println ("z =" + z--); - -System.out.println ("z =" +z); the the //System.out.println ("z =" + ++z); the the //z--;//z = z-1 - the //System.out.println ("z =" +--z); the the //System.out.println ("z =" + z);94 thez = 10; the the intK = + +Z;98 Aboutz + = 2;//z = z+2; -Z-= 2;//z = z-2;101 102Z *= 2;//z = z;103Z/= 2;//z = Z/2;104Z%= 2;//z = z%2; the 106 BooleanLuoji =true&true;107System.out.println ("true && true =" +Luoji);108 109Luoji =true&&false; theSystem.out.println ("true && false =" +Luoji);111 theLuoji =false&&false;113System.out.println ("false && false =" +Luoji); the theLuoji = (2 > 1 & 3 < 4); the 117Luoji =true||true;118System.out.println ("true | | true = "+Luoji);119 -Luoji =true||false;121System.out.println ("true | | false = "+Luoji);122 123Luoji =false||false;124System.out.println ("false | | false = "+Luoji); the 126Luoji =! (2 > 1 | | 3 > 4);//The original result is true, the front added! The result is reversed and false .127 - intv = 2 > 1? 1:2;129 theString str = 4 > 5? "ASD": "";131 theString ss = "";133 134 if(4 > 5) {135SS = "ASD";136 }137 138 intQ = ((2 + 1) * (4-3));139 $SYSTEM.OUT.PRINTLN ("10! = 9 =" + (10 = = 9));141 142String A2 = "";143 144 }145}
The application of Hello.java--java Grammar Foundation