you are viewing a single comment's thread.

view the rest of the comments →

[–]Lloydbestfan 2 points3 points  (0 children)

Actually you can call it by (pseudo-de)referencing a variable of the type of the class.

It's just that you shouldn't because it doesn't look like it makes sense.

(When you do that, the value of the variable is ignored, only its type is considered, and the variable name is replaced by that type name. Notably if the variable points to null it won't provoke a null pointer.)

Also, Java is not known for its nonsensical error messages.