This is what i have so far:
// File: Classify.java
// Purpose: classifies input into primitive types or String
import java.io.*;
import java.util.StringTokenizer;
public class Classify {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
String str = in.readLine();
while (str != null) {
StringTokenizer tokenizer = new StringTokenizer(str);
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
}
str = in.readLine();
}
} // main
} // class Classify
Thanks.
Erm, that's not test data, that's your program. Tee he he.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Well, you could write boolean methods like this:
boolean testInt(String s)
{
try
{
Integer.parseInt(s);
}
catch(Exception e)
{
return false;
}
return true;
}
or something like that.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20