Object creation is a 4 step process in Java
1. new operator allocates memory dynamically for the object
Syntax: Employee e = new Employee();
2. JVM gives default values to the instance variables of the objects.
3. A special method called constructor is executed.
4. new operator binds the objects to the reference variables.
1. new operator allocates memory dynamically for the object
Syntax: Employee e = new Employee();
2. JVM gives default values to the instance variables of the objects.
3. A special method called constructor is executed.
4. new operator binds the objects to the reference variables.
No comments:
Post a Comment