What the JVM is responsible for

  • Loading, checking and executing byte code;
  • Providing a runtime environment for executing bytecode;
  • Memory management and garbage collection;

The Java Virtual Machine is a mechanism that provides a runtime environment for managing Java code or applications. A virtual machine is an independent shell for executing code, thanks to which it can be launched on any OS, without the OS affecting the program being executed.

JVM works with 2 data types: primitive types and reference types.

Primitives

The JVM works with primitive values ​​(integers and floats). Essentially, the JVM is a 32 bit machine. The types long and double, which are 64-bit, are natively supported but occupy two memory units in frame's local or operand stack, since each unit is 32 bits. The boolean, byte, short, and char types are signed wide (except for null-extended char) and work as 32-bit integers, just like int types. Smaller types have only a few type-specific instructions for loading, storing, and converting types. The boolean value works like an 8-bit byte value, where 0 represents false and 1 represents true.

Reference types and values

There are three types of reference types: class types, array types, and interface types. Their values ​​are references to dynamically instantiated class instances, arrays, or class instances that implement the interfaces, respectively.


Read also:


Comments

Popular posts from this blog

Methods for reading XML in Java

XML, well-formed XML and valid XML

ArrayList and LinkedList in Java, memory usage and speed