Explain the Constants, Variable and Data Types in Java?
Answers
Answer:
In java, primitive data types are used to define variables and constants. A variable and constant data types indicates what sort of value it represents, such as whether it is an integer, a floating point number or a character, and determines the value it may contain and the operations that may be performed on it.
Explanation:
I hope its help you....
please mark brainlist answer...
Constants :-
A constant, in Java, refers to a fixed value that does not change during the execution of the program.
Syntax: final<datatype> variable = value;
Example: final int x = 10;
Variables :-
Variables are the storage location in our computer's memory where any value can be stored, since the value which is going to be stored is not fixed, therefore, it is called variables.
Syntax: datatype identifier = value;
Example: int x = 10;
Data Types :-
Data types are used to specify the size and type of value to be stored by a variable.
Types :
It is of two types
i.) Primitive data type
ii.) Non- Primitive data type