1. Package Declaration
A Java application is made up of several classes, and the file name must have the same name as the class name. Package is a keyword for packages that declares the package in which the class resides.
2. Basic data types
For long values, if the assigned value is greater than or less than the int value range, you need to add L or L after the number to indicate that the number is a long integer.
By default, decimals are treated as double type, and if you use float decimal, you need to add F or F after the decimal.
Boolean type uses Boolean.
3. Identifiers
Identifiers consist of any sequence of parents, underscores (_), Dollar signs ($), and numbers, and the first character is not a number.
4. Constants
Use the final keyword.
5. Shift operation
>> right shift the highest bit is 0, the right to move the empty bit is filled in 0, the highest bit is 1, the right to move the empty bit is filled in 1
>>> unsigned Right Shift right move empty bit just fill in 0
Test:
Package Test1;public class TestClass {public static void main (string[] args) {//Boolboolean B = false; System.out.println (b);//constant final float $fData = 10.2f; System.out.println ($fData);//The displacement operation int J = 4;//The highest bit is 0, the right to move the empty bit is filled in 0, the highest bit is 1, the right to move the empty bit is filled in 1system.out.println (J >> 2); 0system.out.println (J >>> 2) is filled in with the right-hand-shifted space;}
The linguistic basis of similarities and differences between Java and C + +