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
I want to persist data of objects for later use. What is the best approach to do so?
Is a class subclass of itself?
How you can force the garbage collection?
Why do we use variables?
What is a modifier?
Can you declare a private method as static?
What is the purpose of a volatile variable?
What is the map interface in java programming?
What is split return?
Write a program in java to find the maximum and minimum value node from a circular linked list.
What is a default constructor and also define copy contrucyor?
What is externalizable interface?
How is the marker interface used in Java?
In the below example, how many string objects are created?
Is alive method in java?