Java Reference

In-Depth Information

This is for real numbers used for calculation such as square roots, sine and cosine. These

are of two types.

Float-
Width in bits is 32 and range is from 1.4e-045 to 3.4e + 038. Float is used as a

variable type for the fractional component, but specifies single precision. It can be used in

representing dollars and cents.

Declaration

Float hightemp;

Double-
Width in bits is 64 and range is from 4.9e-324 to 1.8e + 308.it is used and is optim-

ized in such a way that I can be used for high speed mathematic calculation. It has double

precision which is faster than the single precision. Function such as sin()and sqrt() etc, re-

turn double values.

Declaration

Double pi, r, a;

r = 10.4;

pi = 3.14;

a = pi* r * r;

Characters

• The data type used store or declare character in java is char.

• It is 16-bit type in java. Range of a char is 0 to 65,536.

• There are no chars which are negative in nature.

Program demonstration for char

Class charExample

{

Public static void main (String args []) {

Char a, b;

a=88;

b='y';

system.out.print (“a and b: “);