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 is a boolean in java?
What is a conditional statement explain with example?
Which class is used by server applications to obtain a port and listen for client requests?
define polymorphism in java
Write a program to print 15 random numbers using foreach of java 8?
Have you used any version control ? if so explain about it?
What is difference between static variable and global variable?
What is compareto () in java?
What is the default initialized value of a boolean type variable?
What are hot spots in Java programming?
Which non-unicode letter characters may be used as the first character of an identifier?
What do u mean by wrapper Class? What do u mean by Jvm... How do u change JVM for other OS? Or No need to Change ...? its like tricky