Class and Object

  • Definition of Class

: Class is definition of object.

  • Usage of Class

: Class is used for creating object.

Class

Object

Product blueprint

Product

(Metaphor)붕어빵 기계

붕어빵

  • Components of Object : Properties and Function

Object = Property(Variable) + Function(Method)

class Tv {
    //Variable(=>Property)
    String color;
    boolean power;
    int channel;
    
    //Method(=>Function)
    void power() {power = !power;}
    void channelUp() {channel++;}
    void channelDown() {channel--;}
}
  • Object and Instance

Object : Representative general terms of every Instance.

Instance : Created Object which is from specific Class.

Class ->(Instance화)->Instance(Object)

  • Summary

  1. Why need Class? To create Object.

  2. Why need Object? To use Object.

  3. What does using Object mean? To use properties and function of Object.

Last updated

Was this helpful?