Header Ads

  • Breaking Now

    Is 'sizeof' a keyword?

    No, 'sizeof' is an operator used in C and C++ to determine the bytes of a data item, but it is not used in Java as all data types are standard sized in all machines as per specifications of the language.
    A JVM is free to store data any way it pleases internally, big or little endian, with any amount of padding or overhead, though primitives must behave as if they had the official sizes.In JDK 1.5+ you can use java.lang.instrument.Instrumentation. getObjectSize() to get the object size.
    On JavaWorld, I have found an interesting article on Objects' size determination, read.

    Post Top Ad

    Post Bottom Ad