• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How many objects it would create

 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After running this following program how many objects it would create on the heap:-
please explain me and thanking you
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your guess on this?
 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think two.but please explain me
 
Henry Wong
author
Marshal
Pie
Posts: 21492
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ashok Pradhan:
I think two.but please explain me


Please explain why you think that it is two objects.

Henry
 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mistakenly i write that Two,but it is one because i create the object of only sub class.before that i think two because when we create an object of subclass it first initialize all the instance variable of the super class.so i think that if all the instance variable of the super class is initialized and object of class hold all its instance variables so that the object of the super class
should be created.But it is not true ,when we create the object of sub class,it hold all the instance variables of super class as well sub class instance variables and it only create the object subclass.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic