C:\Users\Admin\Documents\java source code\const>javac const.java
const.java:1: <identifier> expected
class const
^
const.java:5: illegal start of expression
public const()
^
const.java:5: illegal start of expression
public const()
^
const.java:5: ';' expected
public const()
^
const.java:5: illegal start of expression
public const()
^
const.java:5: ';' expected
public const()
^
const.java:18: illegal start of expression
const c = new const();
^
const.java:18: <identifier> expected
const c = new const();
^
const.java:18: '(' or '[' expected
const c = new const();
^
const.java:18: ';' expected
const c = new const();
^
const.java:18: illegal start of expression
const c = new const();
^
11 errors
First, you didn't follow conventions and use an initial capital letter for the class name. Second, having been writing Java for over 10 years, I simply recognized that you were trying to use a reserved word.
Of course, getting our certification helps in recognizing one of the more obscure reserved words. I say obscure because it's reserved yet has no meaning (yet). goto is the other not-used reserved word, and let's hope it stays that way. I wouldn't mind if const would finally get meaning (like an array that cannot be modified, or for immutable objects where the immutability is guaranteed by the compiler), but goto... brrrrrrr.
If you look, the word "const" is in a special/different color, so it means is a reserved word and
cannot be used as a class/method/constructor/variable name
=)
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades: