What I want to do is simple--prompt the user to enter an integer (or String then convert it to an integer). Then store the input in a variable. This is what I have....if there is better way to do this then by all means...I'm open ears
Code: Select all
import java.io.*;
import java.util.*;
public class problem1
{
public static void main (String[] args)
{
InputStreamReader stdin = new InputStreamReader(System.in);
BufferedReader console = new BufferedReader(stdin);
System.out.println("Enter a number");
String input = stdin.readLine();
int number = Integer.parseInt(input);
System.out.println(number);
}
}
Code: Select all
C:\Java>javac problem1.java
problem1.java:12: cannot find symbol
symbol : method readLine()
location: class java.io.InputStreamReader
String input = stdin.readLine();
^
1 error
