• Post Reply Bookmark Topic Watch Topic
  • New Topic

instance variable  RSS feed

 
mark I thomas
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


When I create an object for Identity, if I don't assign any value to SSn, name, id, by default they are null. So does these variables (SSn, name, id) occupy any memory space when you do Identity iden = new Identity() ?
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they do.

They are all reference variables, so they use as much space as is required to contain a reference to an object.
 
Aniket S. Kulkarni
Ranch Hand
Posts: 87
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they occupy memory.

This link may help you.
new keyword

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!