• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error: constant expression required  RSS feed

 
maya pedersen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jfriend lavanya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!