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:
- Object behavior (behavior)--what actions can be applied to an object, or what methods can be applied to an object?
- State of the object--how does the object respond when the method is applied?
- 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:
- Dependency (USES-A): If a method in one class operates on another class's object, then the class relies on another class.
- Aggregation (HAS-A): An object of Class A contains an object of class B.
- 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