JVM (part 3) ~ DataTypes of JVM

Chapter 3

Shanira Perera
2 min readJul 17, 2022

DataTypes

Datatypes are specify the sizes and the values that can be stored in a variable.

They are divided into two categories like Primitive Type and Reference Type. primitive type holding the value of the data and reference types always hold the reference.

Diagram of Datatypes
Image by Author

Primitive Type

Primitive type is one that can be characterized as a basic structure for building more complex data types. when we talk about boolean in jvm it always represent by either int and byte boolean false is represent as a zero and boolean true is represent as a non zero. but if it is a operatable boolean it represent the Int value and if it is a array of boolean it represent as array of bit value.

Size of DataTypes

when we talk about size of these data types all the data types size are same in the every environment. but when we look into the long datatype it has a special difference from others it always takes 64 bit two’s compliment as it size. it’s same in the every environment / implementation.

and there has a another one called return address type it can’t access by the developers because it specific for the JVM it is not in the language. JVM use this for implement the final block.

Reference Type

In this section there had 3 components as we take class it is always reference to instance of the class. and the interface is reference to implementation class instance of this particular interface. array types always reference to arrays.

There was a another Reference type called NULL and it is not specific type which not reference to anywhere

  • There was a keyword called Word Size it is just a base so we need to add values to explain the word size

JVM implementation always talk about the word size and length of the word size is deside by particular implementation.

Rules of define the length of word size

01. Word should be able to hold any primitive data type

02. Two words should be able to carry long or double value

NOTE : according to this rule at least word need length of 32 bit

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Shanira Perera
Shanira Perera

Written by Shanira Perera

Hello, I’m Shanira, welcome to the world of technology. I am an Associate software engineer at virtusa. So let’s begin!

No responses yet

Write a response