【发布时间】:2014-12-10 20:14:04
【问题描述】:
好的,所以当我尝试在 java 中编译它时,我收到以下错误消息
错误:仅当显式请求注释处理时才接受类名称“TokenTest” 1 个错误
这是什么意思,我该如何解决?我已经尝试了很多东西,但无法理解它指的是什么。谢谢你的帮助!这是否意味着我需要更改名称使其不是 TokenTest?
import java.io.*;
import java.util.*;
class TokenTest {
public static void main (String[] args) {
TokenTest tt = new TokenTest();
tt.dbTest();
}
void dbTest() {
DataInputStream dis = null;
String dbRecord = null;
try {
File f = new File("sales.info");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
// read the first record of the database
while ( (dbRecord = dis.readLine()) != null) {
StringTokenizer st = new StringTokenizer(dbRecord, ",");
String fname = st.nextToken();
String lname = st.nextToken();
String city = st.nextToken();
String state = st.nextToken();
System.out.println("First Name: " + fname);
System.out.println("Last Name: " + lname);
System.out.println("City: " + city);
System.out.println("State: " + state + "\n");
}
} catch (IOException e) {
// catch io errors from FileInputStream or readLine()
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
}
}// end if
}// end finally
} // end dbTest
} // end class
【问题讨论】: