Why is boolean data type is called as Virtual Machine Deppendent....? I come across this line while learning for certification exam. Could anyone give me a clear idea regarding this... How the jvm manages the boolean data type.....
I'll have to guess exactly what the context of that question is, but probably what is meant is that it's not specified how much memory a boolean uses - how much memory a boolean uses can be different on different underlying platforms or JVM implementations.
For example, Sun's JVM might use a 32-bit integer for storing booleans in the computer's memory, while HP's JVM might use an 8-bit integer or something else. (This is just an example I just made up, these are not how Sun's or HP's JVMs really work).
For your Java program it makes no difference. A boolean can be 'true' or 'false', and how exactly the JVM stores a boolean in memory doesn't make any difference in the way your Java program works.