Different data types for integers and floating-point values - Java

Why does Java have different data types for integers and floating-point values?

The integer and floating-point types are different in terms of the consumption of the bits which represent them. There are certain data types which are rightly apt for speed and perfect memory utilization. This makes the java applications to execute with efficiency. For example the number 95 is within the range of byte, short, int and long integer types. The data type byte will occupy 8 bits, short occupies 16 bits, and int occupies 32 bits and long 64 bits. If the variable is restricted to hold only the values -128 to +127, then throughout the application it is wise to declare that variable as ‘byte’. Similar applicability is applied for the rest of integer types and floating-point types.
What is endianness? - Java
Endianness is the process of ordering the addressable sub units such as words, bytes or bits in a longer word that is to store in an external memory...
Why Java uses Unicode? - Java
To enable a computer system for storing text and numbers which is understandable by humans, there should be a code that transforms characters into numbers. ...
What are the different loops available in java? - Java
A loop is a set of statements that is supposed to repeat one or more times. Java supports 3 loops...
Post your comment