DEV Community

Divya bharathi G
Divya bharathi G

Posted on

Variable in Java

Variable:

- A variable is the name of a memory location.
- A variable is used to store a value.
- The value of a variable can change during program execution.
Enter fullscreen mode Exit fullscreen mode

Rules for Variable Names in Java

-  Variable name should start with a lowercase letter.
- Variable name can start with $ or _.
Enter fullscreen mode Exit fullscreen mode

Example

byte tamilMark = 60;
Enter fullscreen mode Exit fullscreen mode

Explanation:

- byte → data type
- tamilMark → variable name
- = → assignment operator
- 60 → value
- ; → end of statement
Enter fullscreen mode Exit fullscreen mode

Top comments (0)