Problem category: Compile-time Problems
Diagnosis Difficulty: Easy
Difficulty to Fix: Easy
This problem occurs when you forget to close an open parenthesis/etc., or accidentally put too many closing parenthesis/etc.
Missing closing ]
public class Test { public static void main(String[ args) { } public static void doIt() { } }
Too many closing parenthesis
public class Test { public static void main(String[] args) { int a = (1 + 2) / (3 + 4)); } }
Error Messages
In general, the error messages produced for this type of problem are very similar. Here's an example error message for the first piece of problem code. Sometimes the compiler might spit out the wrong location of the problem because it's matching different parenthesis/etc.
The best way to detect these problems is to properly format your code. See: http://java.sun.com/docs/codeconv/CodeConventions.pdf
Test.java:3: ']' expected
public static void main(String[ args)
public static void main(String[ args)
Add/remove the appropriate syntax marker.
Missing closing ]
public class Test { public static void main(String[] args) { } public static void doIt() { } }
Too many closing parenthesis
public class Test { public static void main(String[] args) { int a = (1 + 2) / (3 + 4); } }