• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DUE AT MIDNIGHT TONIGHT..1 ERROR..HELP

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
gregg,
i just sent you an email..
thank you...
glassy45
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic