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.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is this () in java?

579


What is the size of a string in java?

547


Can singleton class be inherited in java?

518


Explain implementation and how is it different from conversion?

589


What about member inner classes?

631






How we can make copy of a java object?

653


What do you understand by java?

563


How to use arraylist in java netbeans?

510


What is the difference between reader/writer and inputstream/output stream?

555


Is string thread safe in java?

578


Why is the main method declared static?

588


Is string is a data type in java?

589


Explain the differences between static and dynamic variables?

586


What class allows you to read objects directly from a stream in java programming?

512


What is queue in java?

554