Java - Data Types
Java Data Types Java is statically typed and also a strongly typed language because, in Java, each type of data (such as integer, character, hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables defined for a given program must be described with one of the Java data types. Java has two data types, 1) Primitive data types. 2) Non- Primitive data types. Primitive data types. Primitive data are only single values and have no special capabilities. There are 8 primitive data types. 1. boolean The boolean data type represents a logical value that can be either true or false . 2. byte The byte data type is an 8-bit signed two’s complement integer . The byte data type is useful for saving memory in large arrays. 3. short The short data type is a 16-bit signed two’s complement integer . Similar to ...