Multiple choice technology programming languages

Java provide ______ construct to find out the size of an object

  1. sizeOf ()

  2. size()

  3. getSize()

  4. No such method in java to find size of an object directly.

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

Java does not provide any built-in method like sizeof(), size(), or getSize() to directly find the size of an object. The size of an object in memory is implementation-dependent and not exposed through standard APIs. While Java provides methods to find the size of collections and arrays, there is no direct way to get the memory footprint of an object instance.