This code:
public class CommandPrompt {
public static void main(String[] args) {
public static final String prompt = System.getProperty("user.name")+">";
System.out.println(prompt);
}
}
Returns this error message:
CommandPrompt.java:5: error: illegal start of expression
public static final String prompt = System.getProperty("user.name")+">";
^
CommandPrompt.java:5: error: illegal start of expression
public static final String prompt = System.getProperty("user.name")+">";
^
CommandPrompt.java:5: error: ';' expected
public static final String prompt = System.getProperty("user.name")+">";
^
3 errors
I have seen public static final String
been used before, why can't I use it here?