javafirst;//Package name public class Javafirstday {//Basic data type Practice public static void main (string[] args) {byte Byteone = 125;sho RT Shortone = 12345;int InTone = 2345;long Longone = 123l;//defaults to intfloat floatone = 12.3f;//defaults to doubledouble DoubleOne = 12. 3;//char variable assignment of three forms char Charone = ' z '; char chartwo = ' Medium '; char charthree = 99;boolean Isbool = false;//Boolean final int finalint = 12;//constant System.out.println ("Byteone =" +byteone); System.out.println ("Shortone + 123 =" + (Shortone + 123));//parentheses are converted to arithmetic System.out.println ("shortOne123 =" + Shortone + 123); Connect System.out.print ("InTone + 123 =") without parentheses as a string; SYSTEM.OUT.PRINTLN (intone + 123);//No string connection for arithmetic operation System.out.print ("Charthree =" +charthree+ "\ n line break Practice");//Escape Character}}
Java Basic data type exercises