Saturday, 17 August 2013

Primitive Data types

data type informs the compiler what type of data a variable is permitted to store. Data type should also be declared when a variable s declared.

Declaring a data type:     datatypename  variablename

 Java as Java is a strongly typed language The data type indicates what type of values that variable can store and possible operations that can be performed. The language system allocates memory to the variable on the type of data it can hold like an integer or double etc. 
String in Java is not a data type. String is a class from java.lang package. String is not a keyword; Strings are used very often in coding like data types.
Java supports 8 data types that can be divided into 4 broad categories.
All data types are keywords. As a rule, all keywords should be written in lowercase. Java does not support unsigned data types; every data type is implicitly signed (except char). "unsigned" is not a keyword of Java. Note that nulltrue and false are also not keywords.



  • Whole numbers – byteshortintlong
  • Floating-point numbers – floatdouble
  • Character values – char
  • Boolean values – boolean
























  • No comments:

    Post a Comment

    full details in json
    Proudly Powered by Blogger.
    back to top