Reputation: 945
So I have some code that I am tring to compile and I keep on getting this error:
3SATSolver.java:3: <identifier> expected
Here is the code. Am I simply not seeing something?
import java.util.ArrayList;
public class 3SATSolver {
public static void main (String[] args) {
ArrayList values = new ArrayList<Boolean> ();
for (int i = 0; i < args.length; i++) {
Boolean d = new Boolean (args[i].charAt(0), Integer.parseInt(args[i].substring(1)));
}
}
}
Upvotes: 0
Views: 1551
Reputation: 49587
From Java Language Specification
An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.
You can use Character.isJavaIdentifierStart
to check whether your starting letter is a valid identifier name.
char ch = '1';
boolean bool = Character.isJavaIdentifierStart(ch);
System.out.println(bool);
Output = False
Upvotes: 1