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 |
What class is used to implement a Throwable array?
What are types of Java applications?
For class CFoo { }; what default methods will the compiler generate for you>?
How can an exception be thrown manually by a programmer?
Can a java program have 2 main methods?
How many threads can I run java?
how many ways we can serialize the java object?
where final and static variable stored?
What is argument in java?
What are the ways of polymorphism other than Overridding & Overloading
What is abstract class? Explain
Is simpledateformat safe to use in the multithreaded program?