1 //Programmer: Lo Yuanhao 2017.9.242 ImportJava.util.Scanner;3 Public classL {4 5 Public Static voidMain (string[] args) {6 LongA//Exercise 1: Output A variable with a long integer type 1234567890123457a=123456789012345l;8 System.out.println (a);9 Ten floatb=2.4f;//Exercise 2: Output a single-precision decimal constant 2.4 One System.out.println (b); A - BooleanC=true;//Exercise 3: Output A variable of type Boolean - System.out.println (c); theC=false; - System.out.println (c); - - byted=3;//Exercise 4: Forcing type conversions +D= (byte) (b+200); - System.out.println (d); + ASystem.out.println ((Char) (' a ' + 1));//Exercise 5: Output 1-character addition calculation atSystem.out.println ((Char) (' You ' +1)); - - inte=integer.max_value+1;//Exercise 6:int also corresponds to a class, the Integer demonstrates the overflow effect of the variable - System.out.println (e); - -@SuppressWarnings ("resource")//Exercise 7: arithmetic operator +-*/ inScanner input=NewScanner (system.in); - DoubleF; toSystem.out.println ("Enter The X"); +f =double.valueof (Input.nextdouble ()); -f=f/1000*1000; theSYSTEM.OUT.PRINTLN ("The calculation result is" +f); * } $ Panax Notoginseng}
Java Practice---6