Markas Korotkovas wrote:I don't think Scanner has a method nextString(). Try the next() method instead.
Paul Clapham wrote:Okay... and I assume you must have some question about that code? Could you let us know what that question is? Read this: TellTheDetails for more information about how to ask a question here.
I see this is your first post here... welcome to the Ranch!
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Matt Hazan wrote:Right now I am getting an error and my program will not compile.
The error I am getting is: "Illegal modifier for parameter x; only final permitted."
Matt Hazan wrote:Now I am getting an error saying that I did not declare variable x correctly.
Paul Clapham wrote:
Matt Hazan wrote:Now I am getting an error saying that I did not declare variable x correctly.
It doesn't really say "You didn't declare variable x correctly", does it?
Come on, Matt, we have been asking you to provide useful information all through this thread. Don't just provide paraphrases of the error messages, copy and paste them. This is computer programming and accuracy is important.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Matt Hazan wrote:I am sorry for the really 'Beginner no-brainer' questions that most coders might find especially annoying.
I have another question. When it comes to reading from a file, and prompting the user to enter the file name that he would like to read from, how does it work in java? In C programming you can simply place the .txt document in the same directory as the program, and the program automatically picks up on it. So basically my question is, IF i want the user to simply input "filename.txt" and nothing else, and I want the JAVA program to pick up on it, How would I do that?
What I tried to do is create a new .txt file with Eclipse and place it in the same directory as the .java program that searches for it. However, it did not find the file:/
Any advice?
get schwifty. tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
|