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 Passing method and calling back - Part 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Passing method and calling back - Part 2" Watch "Passing method and calling back - Part 2" New topic
Author

Passing method and calling back - Part 2

Carie Herrick
Greenhorn

Joined: Sep 26, 2008
Posts: 16
Hi -

I think I got my code to maybe work, but I'm getting a compiler issue in my getIntFromKeyboard() method. It's not recognizing the numberEntered string value I'm passing to it to parse.

Can someone take a look and tell me what I'm missing?

I'm not good at this coding stuff and am having a hard time putting it all together...

Thanks!

Carie Herrick
Greenhorn

Joined: Sep 26, 2008
Posts: 16
NEVER MIND - just got it to work...

Sorry!
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
It's not recognizing the numberEntered string value I'm passing to it to parse.

And there's your problem: Where are you passing it anything? The method has no parameters (a String parameter would work nicely here), and the variable you're trying to get is local to the main method and thus invisible to the method.

My recommendation: Keep the variable local and use a parameter to pass the String to the method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing method and calling back - Part 2