Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32288
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2015-08-10 05:36 -0700 |
| References | <ebc4e4ca-b5e1-4da2-8583-1a668606cb2d@googlegroups.com> <mq70q5$20v$1@dont-email.me> |
| Message-ID | <5b08503d-429d-429a-b1af-852563619faa@googlegroups.com> (permalink) |
| Subject | Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") |
| From | e.d.programmer@gmail.com |
On Sunday, August 9, 2015 at 3:53:33 AM UTC-4, Eternal Hope wrote: > true is a Java keyword representing the boolean value 'true' > you can't switch on a boolean value I think switch used to work on a boolean, then you could evaluate Strings in the case conditions by comparing your String to other Strings looking for the first case that evaluates to true. In Eclipse now with JDK 8 compile settings this does throw an error. The switch documentation states the switch value may now be a String starting with Java 7, int and enum also work. Eclipse also flags an error if a case value is not a constant, making it seem difficult to do anything useful with a switch besides comparing a Switch, int, or enum to a set of values. Since this sample is only comparing a String matrix this should be easy with a nested switch in Java 7+, though it also looks like schoolwork since a real program would be getting those values from a sort of database.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") srcommunicationsvja@gmail.com - 2015-08-08 06:53 -0700
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-08-08 10:39 -0400
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") Eternal Hope <laughingspam99@gmail.com> - 2015-08-09 08:53 +0100
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") e.d.programmer@gmail.com - 2015-08-10 05:36 -0700
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-08-10 09:17 -0400
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") e.d.programmer@gmail.com - 2015-08-10 07:56 -0700
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-08-10 11:50 -0400
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") Arne Vajhøj <arne@vajhoej.dk> - 2015-08-12 20:51 -0400
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-08-13 08:25 -0400
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") leif.roar@dimnakorr.com - 2015-08-13 08:43 -0500
Re: PLEASE SOLVE THIS ERROR (case 1:from=="VIJAYAWADA") Eternal Hope <laughingspam99@gmail.com> - 2015-08-10 15:39 +0100
csiph-web