Java-Preliminary Understanding-sixth-class-to-object relationship (details)

Source: Internet
Author: User

One

Object. The concept of a member, which has not been described before, is now a discussion of members.

After describing the finished thing, it has properties and behavior. Both property and behavior are part of things. As long as it is part of this thing, we call it a member.

Members are divided into two types, one called member function, and one called member variable.

Defining a class is the member in the definition class.

Before we learned the local variables, we learned the member variables, the variables are defined in different positions. Member variables are defined in a class and are scoped to the entire class. Local variables can only be valid in methods.

The main function is not defined in the car class. Car This class is designed to describe a particular class of things, and it does not need to run independently. This thing is used before it needs to run.

How to use it? Given the drawing, the object is created according to the drawing and finally the object is used.

We often just need to describe, not run. If it is possible to run, write a main function in the class, but it is not necessary.

There are a lot of descriptions of a thing, we do a lot of descriptions in one class, we create entities in another class, we call them.

Java-Preliminary Understanding-sixth-class-to-object relationship (details)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.