Java contains two general categories of built-in data types: object-oriented and non-object oriented. Java’s object-oriented types are defined by classes, and a discussion of classes is defer red until later. However,at the core of Java are eight primitive ( also called elemental or simple) types of data. The term primitive is used here to indicate that these types are not objects in an object-oriented sense, but rather, normal binary values. These primitive types are not objects because of efficiency concerns. All of Java’s other data types are constructed from these primitive types. Java strictly specifies a range and behavior for each primitive type,which all implementations of the Java Virtual Machine 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.
Friday, December 14, 2018
Java’s Primitive Data Types
December 14, 2018
No comments
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment