I'm pretty much a complete newbie when it comes to Java. I've dabbled a bit in python and VB.net, and that's about it.
I'm trying to write a program in java that literally reads the user's input and displays it back to them with this code:
import java.util.Scanner;
public class InputTesting
{
public static void main( String[] args )
{
Scanner input = new Scanner ( System.in );
String str1;
System.out.println("Input string: ");
str1 = input.nextString();
System.out.println( str1 );
}
}
And I get the error:
InputTesting.java:13: error: cannot find symbol
str1 = input.nextString();
^
symbol: method nextString()
location: variable input of type Scanner
1 error
Can someone tell what why it's not compiling? Thanks!