Wednesday 16 October 2013

Session 4:- Data Type In Java



Basic information About Data type
  • When we want store data or information we need appropriate data type for store that information.
  • In java there are so many data type to store data or information.
  • In java mainly two type of data type.
  • NOTE:-  variable name always start with small letter.It's just naming convention its not mandatory.its industry standard.   
    1. Primitive Data Type:-
      • Syntax  : DataType varibale name = value; 
        • Ex:- int i =10;
      • int       :  store Non-Decimal type of numeric value
      • long    :  store Non-Decimal type of numeric value
      • byte    :  store Non-Decimal type of numeric value
      • short   :  store Non-Decimal type of numeric value
      • double/float :store Non-Decimal  and Decimal type of numeric value
        • Ex:- double d =10.20;
        • Ex:- float f =20.50f; 
NOTE:- IF you store decimal value in integer data type than it's give compile time error.
                Ex:- int i=10.20; (Type Mismatch)
    1. Non-Primitive Data Type:-
  •  Indirectly non-primitive data types are behave like as Object.
  •  All our own objects are include in the non-primitive data types category .
      • String : store Alpha Numeric values
        • Ex :- String s="2056/a Jnext Training & Development" ;

No comments:

Post a Comment