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
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 |
Explain the difference between abstract class and interface in java?
Can we clone singleton object?
What is string literal in java?
Why do we need autoboxing in java?
Is integer immutable in java?
Explain exception chaining in java?
How do you sort a list in java?
why there are multiple catches for a try block.don't tell me that there can be multiple exception of a code segment that's why.tell me the real fact behind this.
Explain how to convert any java object into byte array.
What is the difference between a loader and a compiler?
What is balanced tree in java?
Why string is not thread safe?