Java:
1, Boolean variable Boolean (BOOL)
2. Final float afinalvar=3.1415926 (#define AVar 3.1415926)
3, unary operator: prefix operator op;
Suffix op operator;
Binary operator: infix OP1 operator OP2
Ternary operator: OP1? OP2:OP3 equivalent to the If-else statement: If the OP1 is ture, return OP2, otherwise return OP3;
4. Output stream:
Java:System.out.println ("x=" +var); c:printf ("%s,str") c++:cout<< "x=" <<var<<endl;
5. Variable operation:
int + double is double;
6. For 10.0/0.0 (when both types are double) Java considers it to be legal and the result is infinity (Infinity) 0.0/0.0 result is undefined (NaN)
7, string and new string; int and new Integer; = = and equal ();
The string class is a constant of strings and is immutable. While StringBuffer is a string variable, its objects can be expanded and modified.
String.charat (int): Returns the first element of the string, but the stirng type has no subscript;
8. Array:
Statement:
Float[] Arryoffloat=new float[10] or float arrryoffloat[]=new float[10];
Int[] Anarry;
Anarry=new INT[10]; Gets the array length with length rather than length (). Here, length is the property that all arrays have, not methods.
Create and initialize:
Boolean[] answer={0,1,1,0};
String[] str={"You", "is", "abnormality"};
9. instanceof operator
OP1 (object name) instanceof OP2 (class name); Determine if OP1 is an object instance of OP2
10. Jump Statement
Break;continue;lable;return;
A), continue test;
b), break test;
First knowledge of Java