Constants in Java Programming

Constants in Java Programming

Previous Home Next

 

Constants  are variables with values that can not be changed.the value is assigned to a constant when it is declared. constants are used to give names  to certain values to make them meaningful. such as the value to PI is given 3.14 or we can say the name is given to the constant value 3.14 as pi.


 
public class variable
{
public static void main(String arg[])
{
final double
PI=3.14
}

public class variable
{
public static void main(String arg[])
{
final double PI=3.14
}

 

Previous Home Next