- Oct 11, 1999
- 3,064
- 0
- 0
Can anyone point me to one? Everything i've tried searching for on google gives me file input, not keyboard input. And i'm too darn amature to figure out how to just convert it.
Here's what I have so far:
import java.util.*;
import java.io.*;
public class ReadIn {
static public void main(String[] args) {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer inputLine;
inputLine = new StringTokenizer(stdin.readLine());
System.out.println(inputLine);
}
}
But its giving me this error when I try and compile:
ReadIn.java:10: unreported exception java.io.IOException; must be caught or declared to be thrown
inputLine = new StringTokenizer(stdin.readLine());
^
(i'm sure the forum will mess the alignment, the "^" should point to the period between stdin and readLine())
bart
Here's what I have so far:
import java.util.*;
import java.io.*;
public class ReadIn {
static public void main(String[] args) {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer inputLine;
inputLine = new StringTokenizer(stdin.readLine());
System.out.println(inputLine);
}
}
But its giving me this error when I try and compile:
ReadIn.java:10: unreported exception java.io.IOException; must be caught or declared to be thrown
inputLine = new StringTokenizer(stdin.readLine());
^
(i'm sure the forum will mess the alignment, the "^" should point to the period between stdin and readLine())
bart
