Variable in Java

Published: (January 5, 2026 at 10:51 AM EST)
1 min read
Source: Dev.to

Source: Dev.to

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.

Rules for Variable Names in Java

  • Variable name should start with a lowercase letter.
  • Variable name can start with $ or _.

Example

byte tamilMark = 60;

Explanation

  • byte → data type
  • tamilMark → variable name
  • = → assignment operator
  • 60 → value
  • ; → end of statement
Back to Blog

Related posts

Read more »

Java Variables

What is a Variable in Java? A variable is a container used to store data values. Types of Variables in Java Local Variables Example: java class Test { void dis...