Question:

What is a variable in Java programming language?

Show Hint

A variable in Java holds a value and must be declared with a type before use.
Updated On: Jul 14, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

In Java, a variable is a named memory location used to store data that can be changed during the program’s execution.
Every variable in Java must be declared with a data type, which determines the kind of values it can hold.
For example, int age = 25; declares a variable named age of type integer, initialized with the value 25.
Variables help manage data within a program by allowing developers to access and manipulate values efficiently.
They can be of various types: primitive (int, char, boolean, etc.) or reference types (objects, arrays, etc.).
Variables must be declared before use, and they follow strict rules related to scope, type, and naming.
Was this answer helpful?
0
0

Questions Asked in CBSE CLASS XII exam

View More Questions