A Way For Learning

Data types in java - Java

No comments
Data types in java - Java
Two types: Primitive and Reference/Object

Primitive Data Types : 8 types

  • Byte :    8-bit signed,Minimum value is -128 (-2^7), Maximum value is 127 (inclusive)(2^7 -1), Default value is 0,  ex- byte a = 100 , byte b = -50
  • Short : 16-bit signed, Minimum value is -32,768 (-2^15), Maximum value is 32,767 (inclusive) (2^15 -1), ex- short s = 10000, short r = -20000
  • Integer : 32-bit signed ,Minimum value is - 2,147,483,648.(-2^31), Maximum value is 2,147,483,647(inclusive).(2^31 -1),  default value is 0, ex- int x
  • Long :  64-bit signed, Minimum value is -9,223,372,036,854,775,808.(-2^63), Maximum value is 9,223,372,036,854,775,807 (inclusive). (2^63 -1) , Default value is 0L , ex- long a = 100000L, long b = -200000L
  • Float : 32-bit ,Default value is 0.0f,   ex-float y
  • Double : double-precision 64-bit IEEE 754 floating point, default data type for decimal values, Default value is 0.0d,  ex-double x,double d1 = 123.4
  • Boolean: one bit of information-True/False, Default value is false
  • Char : single 16-bit Unicode character, Minimum value is '\u0000' (or 0), Maximum value is '\uffff' (or 65,535 inclusive), ex- char var ='C'

No comments :

Post a Comment