Opening Hours :7AM to 9PM
Constant is an identifier whose value can not be changed.
int x=10; here 10 is a constant x is variable int is a datatype
In java language these constants are classified into following types
1.Numerical constant
2.Character constant
Numerical means numbers .these are classified into 2 types
1.Integer constants
2.Real constants
Integer constants menas + or - numbers.
Example:
int x=10;
int y=-10
Real Constant:
Real constants means floating values or decimal values.
Example:
float x=10.0;
These are classified into following types
1.Single character constant
2.String character constant
If any character or symbol or number enclosed with single quotation.
Example:
char x='a';
char y='2';
char z='@';
Group of characters or symbols or numbers enclosed with double quotation.
Example:
String s1="abc";
String s2="@##$";
String s3="123";