Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


class A
{
private int i;
}
class B extends A
{
private int i;
}

if I create an object of B class what will be the memory of that object.

Answers were Sorted based on User's Feedback



class A { private int i; } class B extends A { private int i; } if I create an object..

Answer / core java

In general we can't get the size of the object.
we Just cant think about this.Because the object is created
by **JVM**.Not by us.Internally some memory location is
allocated by the JVM.who we are talk about the object size.

but for out satisfication we are saying that some size
that depends on the variables only(primitive data types).

When object of the class B is created ,object of C and
object Of Object class are also created.Those properties
references are available in object of class B.

So we just can not think about the size of the object
really.

Is This Answer Correct ?    14 Yes 0 No

class A { private int i; } class B extends A { private int i; } if I create an object..

Answer / bhavya

12 bytes

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More Core Java Interview Questions

what are the methods of an object class?

3 Answers  


what is singleton in java?

0 Answers   IBS,


Why is stringbuffer not immutable?

0 Answers  


Difference between flush() and commit() in hibernate?

2 Answers   Bally Technologies,


What is initial size of arraylist in java?

0 Answers  


Can a static method be final?

0 Answers  


What is runtime polymorphism or dynamic method dispatch?

0 Answers  


What are the drawbacks of singleton class?

0 Answers  


What are File and RandomAccessFile classes?

2 Answers  


What is a singleton factory?

0 Answers  


How does compareto work in java?

0 Answers  


How variables are declared?

0 Answers  


Categories