PDA

View Full Version : annoying Java compiling issue.




Hylekmi
Jan 24, 2012, 12:35 AM
import java.util.Scanner;

public class PizzaStore
{
public static void main(String[]args)
{
Scanner console = new Scanner (System.in);

String day;



System.out.println ("What day of the week is it?");
day= console.nextString ();
}
}//end public class





When i go to compile this i get the error(

PizzaStore.java:14: cannot find symbol
symbol : method nextString()
location: class java.util.Scanner
day= console.nextString ();
)

I have the same code in another program i use (except for the fact that its type Int instead) and it works fine. It could be because of the String. I just don't know and its just plain annoying. Can anyone explain why this is?



jiminaus
Jan 24, 2012, 01:04 AM
Scanner doesn't have a nextString() method. It does though have a next() method.

For your reference: http://docs.oracle.com/javase/6/docs/api/java/util/Scanner.html#next()

dauber
Jan 24, 2012, 02:29 PM
Trust me, use an IDE. I used to code Java manually, but I started using Eclipse at the urging of my Java instructor last quarter and it's been a godsend. Chances are it would have given you a suggestion to basically follow jiminaus's advice.

Hylekmi
Jan 24, 2012, 09:35 PM
I am going to try to get an IDE when i have more time. I am currently swamped with homework and i have to stick with TextWrangler for the time being.

yg17
Jan 30, 2012, 02:00 PM
I am going to try to get an IDE when i have more time. I am currently swamped with homework and i have to stick with TextWrangler for the time being.

It takes a few minutes to download Eclipse and even less time to set it up. In the amount of time it took you to make this thread and wait for an answer, you would've solved your problem if you had a proper IDE.