1. What are the types of reference data? Test analysis.
Answer: There are two kinds.
the first kind, Java provides us with good classes, such as the scanner class, the random class, etc., these existing classes contain a lot of methods and properties that we can use.
Second, we create our own classes, according to the definition of the class, you can include multiple methods and properties in the class for us to use.
2. The definition format of the class
For:
Create A Java file that is the same as the class name
public class class name {
Data Type Property name 1;
Data Type Property name 2;
...
}
3. What is the usage format of the class?
For:
Guide Package: We put all the classes under the same folder and can avoid the guide package.
Create object: Data type variable name = new data type ();
Call Method: currently we define a custom class that does not involve methods, just attributes (the method part of the custom class is explained in the object-oriented section)
Access attribute: variable name . Properties ( this is the current way, and later the method is called to replace the direct access to the way to complete the access to the property.) )
Customization Type considerations:
through the variable name. Property names can be used to manipulate attributes;
Like an array of reference types, a variable of a custom type referencing a type, directly outputting a variable, results in an object address value, which can be simply explained by a memory graph. The memory graph is as follows:
Java Fundamentals Review-5 (Reference data type)