Hello all,
I have a very weird problem going on with a very simple program. Basically I'm using string tokenizer to run a java object in an infinite loop until you type in "Quit". The problem is that I get a compile time error for some reason that I cannot see. Everything looks good syntactically! I've tried putting them together in a package as well as integrating the main method into the test class itself but no dice. The error message I get is:
testdriver.java:16: cannot resolve symbol
symbol : class test
location: class testdriver
test t = new test();
^
My code for my two files (test.java and testdriver.java) are below. Any ideas would be wonderful!
Thanks,
Jisoo23
I have a very weird problem going on with a very simple program. Basically I'm using string tokenizer to run a java object in an infinite loop until you type in "Quit". The problem is that I get a compile time error for some reason that I cannot see. Everything looks good syntactically! I've tried putting them together in a package as well as integrating the main method into the test class itself but no dice. The error message I get is:
testdriver.java:16: cannot resolve symbol
symbol : class test
location: class testdriver
test t = new test();
^
My code for my two files (test.java and testdriver.java) are below. Any ideas would be wonderful!
Thanks,
Jisoo23
Code:
//test.java
import java.io.*;
import java.util.*;
public class test{
String str;
public test(){
str = "Hello World";
}
public String getString(){
return str;
}
}
//testdriver.java
import java.io.*;
import java.util.*;
class testdriver{
public testdriver(){}
public static void main(String args[]){
String line;
String token;
StringTokenizer st;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try{
test t = new test();
line = in.readLine().toLowerCase();
st = new StringTokenizer(line);
token = st.nextToken();
while(!token.equals("quit")){
line = in.readLine().toLowerCase();
st = new StringTokenizer(line);
token = st.nextToken();
}
}
catch(Exception e){
System.err.println("test.java: " + e);
}
}
}