Each Java program must have a main method in the form of:
Public class classname{ publicstaticvoid main (string[] args) { Program Statements } }
The main method in Java must be static.
System.out.println ("Hello world!");
Here, the System.out object is used. and call its Println method. The point number (.) is used to invoke the method.
System.out.print ();//output does not wrap.
Data type:
int 4 bytes
Short 2 bytes
Long 8 bytes
Byte 1 bytes
Java does not have any unsigned type (unsigned).
Float 4 bytes
Double 8 bytes
If you need to have no rounding errors in a numeric calculation, you should use the Biddecimal class.
Char
Boolean:false/true.
Variable:
Variable name: A sequence of letters or numbers beginning with a letter.
Variable declarations, initialization, and assignment are similar to C.
Constant:
In Java, the final keyword is used to indicate a constant, and final indicates that the variable can only be assigned once and cannot be changed later.
Static final class constant, which can be used in multiple methods within a class.
The operator is roughly the same as C no longer looks.
String:
String
String e= "Hello";
Sub-string :
The substring method of the string class can extract a smaller string from a larger string:
String greeting= "Hello";
String s=greeting.substring (0,3);//The second parameter is the first position that you do not want to copy, and this call takes out the 0,1,2 bit
Stitching:
Available + number stitching two strings:
String a= "Hello";
String b= "World";
String c=a+b;
When stitching strings and non-strings, the latter is converted to strings.
Java Learning 1_ some basic 1--16.5.4