I'm a beginner in Java and I'm having problems to declare constants as public, after searching a while in some books, I created this very simple program:
package course1;
public class Circle
{
public static void main(String[] args)
{
public static final double QUARTER_VALUE = 0.25;
System.out.println(QUARTER_VALUE);
}
}
I got the following error message:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Illegal modifier for parameter QUARTER_VALUE; only final is permitted
at course1.Circle.main(Circle.java:7)
The problem is in this line:
public static final double QUARTER_VALUE = 0.25;
I was given the following message when I hover this line:
illegal modifier for parameter QUARTER_VALUE; only final is permitted
I don't understand why, following my books this should work.