top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why does Java strictly specify the range and behavior of its primitive types?

+4 votes
539 views
Why does Java strictly specify the range and behavior of its primitive types?
posted Jan 22, 2016 by Erika

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Java strictly specifies a range and behavior for each primitive type, which all implementations of the Java Virtual Machine (JVM) must support. Because of Java’s portability requirement, Java is uncompromising on this account.

For example, an int is the same in all execution environments. This allows programs to be fully portable.

There is no need to rewrite code to fit a specific platform. Although strictly specifying the size of the primitive types may cause a small loss of performance in some environments, it is necessary in order to achieve portability.

answer Jan 22, 2016 by Atindra Kumar Nath
...