In Java, everything is an object , and the operation of an object is actually borrowed from a reference , like a TV (object) and a remote (reference), or even a remote control without a TV (though it will be an error)!
Almost all programming requires the use of basic types (int, char ...). Java, like C, creates variables directly in the stack, not references. But everything is an object, and Java also provides the corresponding wrapper type, which can be manipulated by reference like other objects. Java also provides BigInteger and BigDecimal two classes that handle high precision.
An array is also an object, created by new and manipulated by reference.
Java also exists scope, the scope of the variable defined in the scope, although the object is not controlled by the scope of the existence, but the reference to the object will disappear after the scope, and its reference to the object is addicted to memory can not be found, and is cleaned up by the garbage collector After the compiler determines that it is no longer needed.
A class is a sheet of an object that defines the instance fields (data) and methods (actions). If the instance domain is a basic data type, Java will give it a default value even if it is not initialized, but this is limited to the instance domain, only the instance domain, and only the instance domain.
Java defines methods as similar to C. The parameters are still references.
The package in Java is a large collection of classes and has a similar effect to namespace in C + +. Packages can be referenced by import .
Using the static keyword can be used to establish an object-independent, and the instance domain associated with the class can be understood as class data. All objects of the class share a static member. To use a static member, you can not only use the object normally. Data, you can also use classes. Data (better). Static methods are similar to static data thinking, but the difference between static and non-static methods is not very large, and one of the most important uses is to invoke the method directly without creating the object of the class, which is important for the main method.
When defining a class, if we do not create a constructor, the compiler will automatically give us a default constructor, and once we have built a constructor, the compiler will not create a default constructor for us.
Java Learning Record-1. It's all about the object.