Object and Class
- Object is the physical as well as logical entity
- Class is the logical entity only
1. Object in java
- An entity that has state and behavior is known as an object
- An object has three characteristics
1_1. state: represents data(value) of an object
1_2. behavior : represents the behavior(functionality) of an object such as deposit, withdraw
1_3. identity : Object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. But is is used internally by the JVM to identify each object uniquely
- Object is an instance of a class
: Class is a template or blueprint from which objects are created
2. Class in Java
- A class is a group of objects that has common properties. It is a template or blueprint from which objects are created
- A class in java can contain
- data member
- method
- constructor
- block
- class and interface
2_1. new Keyword
- The new keyword is used to allocate memory at runtime
3. Example
- Object gets the memory in Heap area and reference variable refers to the object allocated in the Heap memory area
'Back-End > Java_1' 카테고리의 다른 글
[Java] Constructor_2 (0) | 2016.07.26 |
---|---|
[Java] Method Overloading (0) | 2016.07.25 |
[Java] Java OOPs Concepts (0) | 2016.06.27 |
[Java] Json (0) | 2016.06.15 |
[Java] UnicodeSystem (0) | 2016.06.10 |