Social Sciences, asked by Reitwiec7188, 1 year ago

What are the three parts of a simple empty class in java?

Answers

Answered by avdesh1
3
In the Java case:

There is no simple way to find out how much memory an object occupies in Java; i.e. there is no sizeof operator.The size of an object (empty or non-empty) is platform specific.

The size of an instance of an "empty class" (i.e. java.lang.Object) is not zero because the instance has implicit state associated with it. For instance, state is needed:

so that the object can function as a primitive lock,to represent its identity hashcode,to indicate if the object has been finalized,to refer to the object's runtime class,to hold the object's GC mark bits,and so on.

Current Hotspot JVMs use clever tricks to represent the state in an object header that occupies two 32 bit words. (This expands in some circumstances; e.g. when a primitive lock is actually used, or after identityHashCode() is called.)


Answered by dackpower
7

The three parts of a simple empty class in java are;

A simple empty class of java supports legacy, as it automatically acquires object class, therefore can produce the functionality described in the object hierarchy.

It automatically generates a fault constructor inside the class with a blank description.

It also accompanies polymorphism, as can be practiced in any scheme by the extensive class.

Similar questions