The structure and use of java-class

Source: Internet
Author: User

Object-oriented Basic concepts

The object is essentially: attribute + behavior

Class:

-----class is a collection of objects that have common properties and behaviors

-----class defines the properties and methods of an object

-----can instantiate multiple objects of this class through a class, each object has a different property value, which can be said to be similar to a design drawing, and the object is like a multi-storey building built out of drawings.

-----class is the basic constituent unit of a Java program

Object-oriented:

Object-oriented refers to the analysis, design and implementation of the system with the object as the basic unit.

Basic structure of Java class

Structure of the class:

----attribute: Description of the object data;

----Method: The behavior of the object; (things you can Do)

----Construction method: Used to instantiate the object;

----Inner class: (inner Class) is the class declared in the class body.

----BLOCK: Divided into static block, instance block

Declaration form and function of class

Declaration form of a class

Class Name {

Class Body

}

Class: A class is a template that defines properties and methods common to multiple objects
Declaration form and function of attribute

"Access modifier" "modifier" Data Type property name "= initial value";

----property is the object's data

----property, also known as a member variable, is a variable declared in a class, a variable declared in a method body is called a local variable or a temporary variable

Such as:

--private String name;

--private double salary;

--private static int count=0;

The structure and use of java-class

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.