Multiple choice technology web technology

How to find the size of Object in Java?

  1. By using sizeof operator

  2. By calling malloc method

  3. By calling getObjectSize method of Object

  4. None

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Java has no sizeof operator or built-in way to get object size at runtime. The malloc method doesn't exist in Java (memory management is automatic), and Object class has no getObjectSize method. Object size is implementation-dependent and not directly accessible.