Javase Part 4

Source: Internet
Author: User

4.1 Object-oriented

Process-oriented and object-oriented the former focus on action, the latter focus on the object (in fact, the action has been encapsulated, direct call on the line)

Class

Properties

Method () {}

} class: Just a template (description) that creates objects from a template, each with its own method. Object: is a solid entity (new in heap memory)

Face object characteristics: encapsulation, inheritance, polymorphism

An anonymous object can only be used once to create a new object at a time Eg:new class name () function: For objects that are used only once, it is convenient to use the method: Call a method or property, pass the object

Encapsulation: To avoid direct user access to data properties, to provide users with interface (the scope of the method can specify the extent of the property) indirect access using note: Private decorated properties typically require a set get method

Permission modifiers: Private can only be used in this class

Constructor: When you create a class object, the constructor is called first (if there is no initial block): Initializes the object. Note: The default constructor (null argument) does not exist when the constructor is already in effect.

This,super Keyword: This prevents the system from mistakenly thinking that a variable with the same name is assigned to the same variable this-> the current object

            

Javase Part 4

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.