aspose file tools
The moose likes Java in General and the fly likes Error: constant expression required Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Error: constant expression required" Watch "Error: constant expression required" New topic
Author

Error: constant expression required

maya pedersen
Greenhorn

Joined: May 27, 2004
Posts: 6
Hi, I'm having problems switching on my public static final ints


The code above is called from class MeterReportManager that extends ReportUtils, which is a public abstract class. The constants (FORMAT_HTML etc) are members of ReportUtils.

I've tried to do the case like:
case ReportUtils.FORMAT_PDF:
case MeterReportManager.FORMAT_PDF:
case FORMAT_PDF:

but none of them work compiletime in JBuilder 2005
Does anyone have a clue why?

Sincerely,
Maya Pedersen


live long and prosper
Jfriend lavanya
Greenhorn

Joined: Mar 23, 2005
Posts: 2
hi
always the expression near case expect constant value.
but no problem for using final variables.

i worked out a program similar that of yours.
its working fine.

try to print the value of the final variables after commenting switch
and check their values
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Error: constant expression required
 
Similar Threads
Robot - can't get symbols: !@#$^&*()_+
mySQL INTEGER == LONG in Java and ....???
Puzzled
Just Java 2 clock class help required (Resolved)
Numeric value convert to word format