Integer is a wrapper class in Java that can be used for both string and integer conversions, as well as for unpacking and boxing
PackageABC; Public classa{ Public Static voidMain (string[] args) {//TODO auto-generated Method Stub//get the maximum value for shaping intmax=Integer.max_value; //Maximum output valueSYSTEM.OUT.PRINTLN ("Maximum value for shaping is" +max); //maximum value plus 1SYSTEM.OUT.PRINTLN ("Maximum value for shaping is +1" + (max+1)); //The maximum value plus 2 becomes a long typeSYSTEM.OUT.PRINTLN ("Maximum value for shaping is +1" + (max+1)); //cast to long typeSystem.out.println ("The maximum value for shaping is +2" + ((Long) max+2)); }}
Run
The maximum value for shaping is the maximum value of 2147483647 shaping is the maximum value of +1-2147483648 shaping is +1-2147483648 The maximum value for shaping is +22147483649
Character and Integer conversions: Char type assignment is enclosed in a pair of single quotation marks (");
PackageABC; Public classB { Public Static voidMain (string[] args) {//TODO auto-generated Method Stub//Defining characters CharCh1= ' a '; //define character, Integer to character CharCh2=1; System.out.println ("Ch1=" +ch1); System.out.println ("Ch2=" +CH2); }}
Run
ch1=a;ch2=a;
Common escape characters:
\f: Page Change
\b: one step backwards
\ n: Line break
\ t: Tab tab
\ r: Return position
\ \: Backslash
\ ': Single quote
\ ": Double quotation marks
Application of escape characters:
PackageABC; Public classC { Public Static voidMain (string[] args) {//TODO auto-generated Method Stub//Defining escape characters Charch1= ' \ "'; //Defining escape characters Charch2= ' \ \ '; System.out.println ("CHA1" +ch1); System.out.println ("CHA2" +CH2); //Direct output Escape characterSystem.out.println ("\" Hello\ ""); }}
Run
CHA1"cha2" Hello "
Data overflow of Java