Java is an Object-Oriented Language. As a language that has the Object Oriented feature, Java supports the following fundamental concepts:
- Polymorphism (多态性)
- Inheritance(继承)
- Encapsulation (封装)
- Abstraction (抽象)
- Classes (类)
- Objects (对象)
- Instance (实例)
- Method (方法)
- Message Parsing (消息解析)
In this chapter, we will look into the concepts Classes and Objects.
-
Object - Objects have states(状态) and behaviors(行为). Example: A dog has states - color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class.
-
Class - A class can be defined as a template/blue print(蓝图) that describes(描述) the behaviors/states that object of its type support.