This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Problem with a switch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem with a switch" Watch "Problem with a switch" New topic
Author

Problem with a switch

Laurent Quenon
Greenhorn

Joined: Dec 09, 2003
Posts: 11
Hello all,
I'm sure what I'm asking is realy stupid but it's already a long time I'm looking for a solution without any success, so I hope that somebody will be able to point out my mistake.
I have the following code:
public Map queryDB (String args[], int swKey)
{
String querystring;
switch(swKey)
{
case 1:
querystring = "SELECT * FROM Player";
break;
}
When I try to add an instruction after this switch it looks that everything is unresolvable. Indeed I don't have the automatic completion anymore and if I try to use query string it says that it cannot be resolved.
Thanks a lot for your help.
And sorry again if it's just too obvious for most of the people here.
Merry Christmas and Happy New Year.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

Could you please post the code that you are having problems with? This code in itself seems to be fairly straightforward, so I think that we could only help if we can see code that has the problem.
Thanks,


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
Originally posted by Laurent Quenon:
Hello all,
I'm sure what I'm asking is realy stupid but it's already a long time I'm looking for a solution without any success, so I hope that somebody will be able to point out my mistake.
I have the following code:
public Map queryDB (String args[], int swKey)
{
String querystring;
switch(swKey)
{
case 1:
querystring = "SELECT * FROM Player";
break;
}
When I try to add an instruction after this switch it looks that everything is unresolvable. Indeed I don't have the automatic completion anymore and if I try to use query string it says that it cannot be resolved.
Thanks a lot for your help.
And sorry again if it's just too obvious for most of the people here.
Merry Christmas and Happy New Year.


Hi Laurent, Your question seems a little bit short. My guess is that you forget a braclet }. If you post the entire code block then maybe we'll be able to help more.


- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. <br />- What truth? <br />- That there is no spoon!!!
Laurent Quenon
Greenhorn

Joined: Dec 09, 2003
Posts: 11
Don't worry I think it's just a bug in Eclipse...
I didn't change anything I just closed and restart Eclipse (not even save, it was already saved before) and now it works perfectly.
Sorry to bother you,
But thanks again.
Merry Christmas and Happy New Year.
 
jQuery in Action, 2nd edition
 
subject: Problem with a switch
 
Similar Threads
escape for &
Simple AJAX query what I'm missing?
JSP and MySql question
self generated jsp
JDBC Newbie