File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes DUE AT MIDNIGHT  TONIGHT..1 ERROR..HELP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "DUE AT MIDNIGHT  TONIGHT..1 ERROR..HELP" Watch "DUE AT MIDNIGHT  TONIGHT..1 ERROR..HELP" New topic
Author

DUE AT MIDNIGHT TONIGHT..1 ERROR..HELP

judy ri
Greenhorn

Joined: Sep 05, 2003
Posts: 11
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

Joined: Jul 11, 2001
Posts: 15286
    
    6

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.


GenRocket - A Test Data Generation Platform
judy ri
Greenhorn

Joined: Sep 05, 2003
Posts: 11
sorry..
it's the (while pickSelection =!3)
that it won't recongize..
judy ri
Greenhorn

Joined: Sep 05, 2003
Posts: 11
gregg,
i just sent you an email..
thank you...
glassy45
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

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

Joined: Sep 05, 2003
Posts: 11
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

Joined: Jul 11, 2001
Posts: 15286
    
    6

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

Joined: Jul 11, 2001
Posts: 15286
    
    6

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

Joined: Sep 05, 2003
Posts: 11
YOU Rock!!!
thank you so much...
making me crazy..
and...thank you for the fast response..
much appreciated..
judy
judy ri
Greenhorn

Joined: Sep 05, 2003
Posts: 11
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

Joined: Sep 05, 2003
Posts: 11
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

Joined: Jul 11, 2001
Posts: 15286
    
    6

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

Joined: Jun 02, 2003
Posts: 1923

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.


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DUE AT MIDNIGHT TONIGHT..1 ERROR..HELP
 
Similar Threads
switch ??
Switch statements
Switch help?
Do while error, I'm going crazy
How close am I in getting this program right?