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
What is this () in java?
What is the size of a string in java?
Can singleton class be inherited in java?
Explain implementation and how is it different from conversion?
What about member inner classes?
How we can make copy of a java object?
What do you understand by java?
How to use arraylist in java netbeans?
What is the difference between reader/writer and inputstream/output stream?
Is string thread safe in java?
Why is the main method declared static?
Is string is a data type in java?
Explain the differences between static and dynamic variables?
What class allows you to read objects directly from a stream in java programming?
What is queue in java?