201671010128 2017-09-10 "Java Programming" objects and classes

Source: Internet
Author: User

Several key concepts of programming to objects: Abstract data types, classes and objects, encapsulation, class hierarchies (subclasses), inheritance, polymorphism.

    • A class is a conceptual model that defines all the attributes of an object and the actions required, and the class is the prototype of the object.
    • An object is a concrete entity that exists, with clearly defined states and behaviors.

There are three main characteristics of the object:

    1. Object behavior (behavior)--what actions can be applied to an object, or what methods can be applied to an object?
    2. State of the object--how does the object respond when the method is applied?
    3. Identity of an object--how do you identify different objects with the same behavior and state?
    • all of them belong to the same class objects all have the same features and operations.
    • In Java, the object is constructed and initialized with a constructor (constructor).
    • A constructor is a special method in a class that has the same name as the class name.
    • The relationships between classes:
    1. Dependency (USES-A): If a method in one class operates on another class's object, then the class relies on another class.
    2. Aggregation (HAS-A): An object of Class A contains an object of class B.
    3. Inheritance (IS-A): Represents a relationship between a particular class and a generic class. In general, if Class A inherits Class B, then class A inherits not only the method and state of Class B, but also its own method and state.

2. Object-oriented Programming course learning progress bar

Moonphases (read/write) Number of lines of code Posted Blog Volume/Blog comments number Classroom/after-school time (hours) The most satisfying programming task
First week 20/7 1/1 6/4 Write the Hello World program
Second week 38/20 1/1 6/4 Experiment two task three
Third week 50/30 1/1 6/5 Experiment Three
Cumulative

201671010128 2017-09-10 "Java Programming" objects and 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.