Reference data type classification

Referenced class is both a class of their own definition, is widely used behind

  Class Definition Format

Create a java file with the same name as the class

{public class name of the class

    Attribute Name Data Type 1;

    Attribute Name Data Type 2;

    …

}

publicclass Phone {

    /*

     * Attributes

     */

    String brand; // Make Model

    String color; // color

    Double size; // size

}

Guide package: We will all classes together under a folder, you can avoid lead pack.

Create objects: data type variable name = new data type ();

Call the method: We define custom class method does not involve only attributes (custom class in the methods section in object-oriented part of the explanation)

Access attributes: variable name attribute (this is the current way, the latter will take the form of an alternative method to call off direct access to complete access to the property.)

Guess you like

Origin www.cnblogs.com/sy130908/p/11327994.html