Mastering Java Core Technology is the key to learning and mastering Java technology, with 17 points below to explain these Java core technologies.
No more inheritance in 1.Java, but instead of multiple inheritance with interfaces
2. When you run a compiled program, the Java interpreter always executes from the code in the main method of the specified class, so you must have a main function in the execution code.
3.Java is a typical strongly typed language, that is, you must declare the type of the variable, there are 8 types in Java, 6 numeric types (4 integers and 2 floating-point types), one character type, and one Boolean type.
4. Force type conversions:
int NX = (int) x; (Syntax: Enclose the target type with parentheses followed by the variable to be converted);
5.Java cannot define a local constant for a separate method, such as the main method, but only a constant for a class that is used by all methods of the class, so it is often called a class constant. Such as:
class UsersConstants{
public static final double g = 32;
public static final double main(String[] args){
System.out.println(g);
}
}
Note: Constants are defined outside the main method and must have the keyword static final;
6. Substring of string:
String str = hello"";
String str1 = str.substring(0,4); //输出hell
7. Do not use the = = operator to test whether two strings are equal, the operator can only determine whether two strings exist in the same location.
With equals.
String str = "hello";
str.equals("hell"); // return false;
8. The behavior, state, and identity of the object
9. Process-oriented and OOP