Monday, September 19, 2011

Declaring Variable and Literals, Data Types, Keywords in Java

Declaring Variable and Literal
Java supports some basic programming elements, such as data types, keywords, literals and variables. Keywords are the reserved words for Java programming language, which cannot be used as names for variables, class or methods.

Various Data Types
The data stored on memory of the computer can be of different types. For example, a person’s age is stored as a numeric value and an address is stored as alphanumeric characters. Java is a strictly typed language, which means that Java gives importance to type checking. Expressions and variables in Java can be of different types, such as int, char, or string. Data Types in Java are divided into two categories as stated below:
  • Primitive or the simple data types
  • Abstract or the derived data types