Java notes: Objects, methods, classes

Source: Internet
Author: User

1, data type (Class) object name;

  This requires that the data type must be a composite data type, and that the structure of the basic data type declaration is only called a variable, not an object.

Initialization of the object

Object name = new construction Method (parameter);

2. Method:

Access control [modifier] return value type method name (parameter list) {
Method body
}

3. Class:

access control modifier [modifier] class name {

The scope of the property declaration property is the internal public int x = 10 of the class;
[Method declaration]
[Construction Method declaration]
}

The following two points differ mainly in abstract and entity classes:
1. Abstract classes cannot create objects using their own construction methods (syntax not allowed)

2. An abstract class can contain any (0, one or more) abstract methods inside

4, constructs the method: Implements the class this kind of data type the variable initialization.

  Access Control constructor Method name (parameter list) {

Construction method body;

  }

1.

a method that has a return value. The direct string i= the method name (), and the return value can be taken.

Java notes: Objects, methods, classes

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.