Creating an Object:
As mentioned previously a class provides the blueprints for objects. So basically an object is created from a class. In java the new key word is used to create new objects.There are three steps when creating an object from a class:
- Declaration . A variable declaration with a variable name with an object type.
- Instantiation . The 'new' key word is used to create the object.
- Initialization . The 'new' keyword is followed by a call o a constructor. This call initializes the new object.
No comments:
Post a Comment