Reference data type
-
Data types in Java can be divided into basic data types and reference data types in two major categories
-
int, float, char, Boolean, etc. are all basic data types
-
Class types are reference data types
-
Reference data types are similar to pointers in the C language, and multiple reference data types can reference the same object
-
A variable of the base data type has a copy of its own value, and the reference data type is the value that points to its own heap space.
Polymorphic
-
Polymorphism in Java can only occur in methods, and the exact same properties between child parent classes do not occur polymorphic.
-
The exact same attributes between child parent classes determine which one to access by referring to the type rather than the actual object's type.
public static void Main (string[] args) Analysis:
-
Public declares that main is common so that the JVM can access the main method, which is equivalent to a cross-package invocation, so it is the same reason that the class name that contains the main method is also decorated with the Because the JVM needs to find it and the main method in it.
-
Static indicates that the main method does not need to be accessible by a new object.
-
void Main (string[] args) is a method return value, method name, and method parameter.
In the Java language, you can add a * * @Override * * Prompt to a method overridden by a subclass so that the compiler checks whether the method overrides are legitimate.
-
This is good, avoid rewriting the function name and so on wrong, but the compiler will not error the embarrassing situation.
-
A subclass can implement multiple interfaces, but all of the methods in the interface must be implemented, or the subclasses will become abstract classes.
02-java Foundation and object-oriented (supplementary)