Saturday, 27 June 2015

FLOAT AND DOUBLE

Float and Double : these two datatypes always stores the real Constant.
Real Constant is always by default double in nature.( example, 4.2 is double in nature and thus, it is a real Constant.)
Thus, float x = 4.2; is an error.
Rather you have to typecast it as : float x = (float)4.2; or float x = 4.2f.

CHARACTER DATATYPE:
Character in JAVA supports Unicode. 65536 number of characters are supported by the JAVA language, since the maximum value of 16bits is 216 which is 65536.
Boolean in JAVA only supports true or false values.