Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

'.class' expected AND not a statement

807603Nov 9 2007 — edited Nov 9 2007
Getting these two compile errors ('.class' expected AND not a statement) on line 19:

import java.io.*;
import java.lang.*;
import java.util.*;

public class TestReader {
public static void main(String[] arguments) {
try {
FileReader file = new FileReader("vocab.txt");
BufferedReader buff = new BufferedReader(file);
boolean eof = false;
HashMap defMap = new HashMap();
HashMap exMap = new HashMap();

while (!eof) {
String line = buff.readLine();
if (line == null)
eof = true;
else
String[] res = line.split("\t");
defMap.put(res[0], res[1]);
exMap.put(res[0], res[2]);
;
}

buff.close();

// For both the keys and values of a map

for (Iterator it =defMap.entrySet().iterator(); it.hasNext(); ) {
Map.Entry entry = (Map.Entry)it.next();
Object key = entry.getKey();
Object value = entry.getValue();
System.out.println("Key = " + key + " and Value = " + value);
}

} catch (IOException e) {
System.out.println("Error -- " + e.toString());
}
}
}

Any suggestions?

(Thanks!)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2007
Added on Nov 9 2007
6 comments
160 views