is the basic data type of Java
PackageCom.hgd.study;/*** Data type of Java *@authorHutiger **/ Public classDataType { Public Static voidMain (string[] args) {//syntax for defining a data type /** 1. Data type variable name = literal * 2. Data type variable name; * Variable name = literal 1 * Variable name = literal 2 * Variable name = literal 3*/ /** Long range -2^63-->2^63-1 * int range -2^31-->2^31-1 * Short range -2^15-->2^15-1 * Byte range -2^7 -->2^7-1 * Float range 2^127-->2^149-1*/ Longlmin=-9223372036854775808l;//defines the type of a long to be case-insensitive in L Longlmax=9223372036854775807l; floatf=9.98f;//defines a single-precision floating point type that needs to be followed by an F case insensitive Doubled=95.00d;//defining a double-precision floating-point type needs to be followed by an F case insensitive Booleanfals=false;//Boolean typeSystem.out.println (Fals);//falsefals=true;//The literal value of a variable can be changedSystem.out.println (Fals);//true//Char type CharC= "; C= ' 1 '; C= ' People '; //----------------------Practice intX=1; SYSTEM.OUT.PRINTLN (x); Chary = ' 1 '; System.out.println (y); //Java is a strictly differentiated data type languageSystem.out.println (x+2);//result =3System.out.println (y+2);//result =51}}
Java Learning notes: data types for Java