What is a class?
A class is a collection of objects with the same properties and methods, and is an abstract concept
What is an object?
All objective things can be called objects, which are objective
Properties : Characteristics of an object
method : Function of object, operation
Name of the class name method: The first letter all need capital, pay attention to the code specification!!
The class file is in *. The Java method is named
After the class is instantiated, its properties and methods are loaded into memory
The float variable must be assigned a value of f, otherwise it is a double type
Two: member variables and local variables
Member variables are defined in the class and can be accessed by the class, scoped to the current entire class
A local variable is defined in a class method and can only be accessed in a method, scoped only to that class of methods
The member variable is given an initial value, and the local variable is not assigned the initial value
when two types of variables have the same name, local variables have higher precedence (the nearest principle )
Three: Construction method
new+ construct method can create a new object
The constructor method has the same name as the class, and the tangent has no return value
In a package is not allowed to have the name of the class, different packages can have the same name of the class, according to the package name + class names to distinguish
The package is named in all lowercase letters, COM. Company Name ...
The main functions of the inner class are as follows:
1. The inner class provides a better encapsulation that hides the inner class within the outer class and does not allow other classes in the same package to access the class
2. The method of the inner class can access all the data of the external class directly, including the private data
3. Functions implemented by internal classes can also be implemented using external classes, but sometimes it is easier to use internal classes
Java first day classes and objects