Variables

  • Variables stores data for processing.
  • A Variables is given a name (or identifier ) such as area , height ,etc.
  • The name uniquely identifies each variable assigning a value to the variable & retrieving the valued stored.

Variables have types :-

  1. int : for integer (whole numbers) such as (123 and -567).
  2. float : for fractional parts such as 45.6 , 2.7 ,
  3. double : for floating point or real numbers with optional decimal points & fractional point is fixed or scientific notations such as 3.454, -45.67 .
  4. String : text strings are enclosed in double quotes.e.g String name = “Crazy”.
  5. char : holds only single character.
  6. boolean : holds only two values true or false.

DATA TYPES :Data Types in Java are divided into two categories Primitive and NonPrimitive.

Note:-Java does not support the concept of unsigned types and therefore all java values are signed.