Directly to the point to talk about self-study content:
Define the legal identifier rules:
- It may consist of letters, numbers, _ , $ components.
- Start with a number and can not contain spaces.
- Keywords and reserved words can not be used, but can contain keywords and reserved words.
byte short int long float double char boolean is . 8 kinds of basic data types are all other reference data types.
Integer types: byte ( -128-127 ), Short , int , Long .
Float Type: Double , a float (need to add the assignment after the number F );
Basic data type in the code I have written:
public class Test {
public static void main(String args[]) {
// output
System.out.println("helloworld!");
// simple integer variable is defined and adder
int i=3;
int b=2;
int c=i+b;
// output operation result
System.out.println("i+b="+c);
// float type definition
float k=1.22f;
// output variables
System.out.println(k);
// Get the maximum value of type float
float maxF=Float.MAX_VALUE;
// maximum output
System.out.println("maxF="+maxF);
// Get the minimum value of type double
double a=Double.MIN_VALUE;
// minimum output
System.out.println("a="+a);
// define a variable of type char
char c1='A';
// output variables
System.out.println(c1);
// define a String
String k1="helloworld";
// output
System.out.println(k1);
// define a String
String k2="he"+"llo"+"world";
// Check whether the output and consistent
System.out.println(k2);
// define Boolean
Boolean b1=true;
// output
System.out.println(b1);
}
}
Knock yourself by learning a lot of code, increasing the practical ability and increase your programming ability, I had a very fulfilling feeling. We will insist on self-study every day, knocking the code every day.