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 externalizable interface?
Can list be final in java?
Why are constructors used?
Why do we override tostring method in java?
Which sorting algorithm is best in java?
Explain importance of inheritance in java?
How does java enable high performance?
Can I declare class as static or private?
What types of index data structures can you have in java?
Can a list be null in java?
Compare Mutex and Semaphore in java.
What is the static method?
What is mnemonic code?
Explain notifyall() method of object class ?
What is the latest java version?