In Java, the word “String” is not a keyword. That is, we can write:
String String = "";
without the compiling error.
Also, java.lang.String class can not be used as a second parameter of the “instanceof” operator.
Why? What’s so special about the String class for the Java compiler and why it isn`t a keyword?
First, String is a Class name, not a keyword. So you are free to use it as a variable name, although it’s not recommended.
Second, I don’t think your statement on “java.lang.String class can not be used as a second parameter of the “instanceof” operator” is correct.
I have created a test program named
T2.java, it compiles and runs as expected: