Re: why doesn't this work? final assignments and switches
From: Roedy Green (see_at_mindprod.com)
Date: 04/18/04
- Next message: Roedy Green: "Re: End of File"
- Previous message: Daniel Sjöblom: "Re: no pointer in Java => my problem"
- In reply to: xaos: "why doesn't this work? final assignments and switches"
- Next in thread: Roedy Green: "Re: why doesn't this work? final assignments and switches"
- Reply: Roedy Green: "Re: why doesn't this work? final assignments and switches"
- Reply: xaos: "Re: why doesn't this work? final assignments and switches"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 18 Apr 2004 02:15:30 GMT
On Sat, 17 Apr 2004 19:46:18 -0400, xaos <xaos@aol.net> wrote or
quoted :
>case A0:
>// compiler complains:
>// constant expression required
>// but isn't A0 etc constant ?
switch cases want [values known at compile time. Yours are not known
until the class is instantiated.
try static final A0 = 0;
But if you are calling them A0, why not just say 0?
-- Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
- Next message: Roedy Green: "Re: End of File"
- Previous message: Daniel Sjöblom: "Re: no pointer in Java => my problem"
- In reply to: xaos: "why doesn't this work? final assignments and switches"
- Next in thread: Roedy Green: "Re: why doesn't this work? final assignments and switches"
- Reply: Roedy Green: "Re: why doesn't this work? final assignments and switches"
- Reply: xaos: "Re: why doesn't this work? final assignments and switches"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|