This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DUE AT MIDNIGHT TONIGHT..1 ERROR..HELP

 
judy ri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
at the end of my program i have this:

case 2:

// Display Authors name and address



System.out.println (",");
System.out.println (",");
System.out.println (",");
System.out.println (",");

break;

case 3:

break; }

} while (pickSelection != 3);



}
}

i took out my address info..i keep getting an error that says it's improper or not legal..
it works in another girls program and i can't figure it out..
please help..
thank you..
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I can't tell what the heck you are trying to do with that little bit of code fragment.
2. You need to give us the exact error message you are getting
3. Is it at compile time or runtime
4. If possible, what exact line is the error being thrown on
5. Are sure it works in the other girls problem? Maybe she changed it because she knows you are using her work.
 
judy ri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry..
it's the (while pickSelection =!3)
that it won't recongize..
 
judy ri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gregg,
i just sent you an email..
thank you...
glassy45
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Judy, the only way people will learn is to keep discussions like this public. So I am going to post the code you sent me in an Email and we will try and solve your problem here, ok?

Now, the only thing I see right off the bat is the fact that nowwhere else in your code do you have any reference to pickSelection. Where did this variable come from? Where was it created and given a value?
Also, I can't compile your code because you have a Utility object which is not part of the standard JDK, so without access to that object...Well, you get the idea.
Anyway, tell me where that pickSelection variable came from.
Nevermind, I found that variable. I am going blind.. Let me take a look at this for a minute.
[ September 29, 2003: Message edited by: Gregg Bolinger ]
 
judy ri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no problem gregg....
wasn't sure how to do it..
i can send you that utility file so you can run it..
thank you for helping me..
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like it is a scope issue. I moved your byte pickSelection; out of your main method and made it global to the class. I also had to make it static since main() is static.
So the beginning of your program now looks like:

And that I believe solves the problem.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You see, the problem is that in this type of statement:

everything between the { } for the do is out of scope for the while. Does that make sense?
 
judy ri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YOU Rock!!!
thank you so much...
making me crazy..
and...thank you for the fast response..
much appreciated..
judy
 
judy ri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, it makes total sense..
i took a color marker and marked the brackets to try and figure it out..
i was postive it was a bracket problem..
but no matter what i did..it wouldn't work..
 
judy ri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the gal that was helping me...must of had her's within the scope, and we didn't even realize it..
she is very helpful..and no malice..
i help her with english...
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, glad everything worked out for you then. Hope to see you around Javaranch a lot more in the future. Good luck!
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:
You see, the problem is that in this type of statement:

everything between the { } for the do is out of scope for the while. Does that make sense?

But you needn't make the var static and a membervar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic