Core Java SQL Oracle PHP Examples JSP JDBC MORE

Java variable


In Java Variables are used for storing values such as numeric values, characters, character strings, or memory addresses.

In Java a variable starts with the data type, followed by the name of the variable.

Example :
int a=10;
Here int is the data type name.
a is the variable name and 10 is literal type integer.
Meaning, the a variable store the integer values 10 here.

Rules for Naming Variables in Java

  • Variables in Java are case-sensitive.
  • You can start a variable name a letter, $ or _.
  • Whitespace are not allowed in java variable.
  • Note: It is good to start the variable name with a letter.