|
|
|
|
|
|
|
|
|
|
|
|
|
|
JAVA PROGRAMMING
The Simple types Java defines eight simple types of data: byte, short, int, long, char, float, double, and boolean. Integer Java defines four integer types :byte, short, int and long. All of these are signed, positive and negative values. The width and ranges of these integer type vary widely, as shown in this table:
Declaration of Integer types long price; int num; short qty; byte bt;
Floating - Point Types Floating-point numbers, also known as real numbers, are used when evaluating expressions that require fractional precision. Their width and range shown here:
Declaration of floating-point types double price; float salary; Character In Java, the data type used to store character is char. In Java, char is a 16-bit type. The range of char is 0 to 65536. Declaration of character types char ch; Boolean Java has a simple type, called boolean, for logical value. It can have only two possible values, true or false. Declaration of boolean types boolean b; A sample code using different data types:
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|