What is an method in Java? Can it be overridden?

Have a look at the Java Virtual Machine Specification, chapter 2.9. It say on the <init> name:

At the level of the Java Virtual Machine, every constructor written in the Java programming language (JLS §8.8) appears as an instance initialization method that has the special name <init>. This name is supplied by a compiler. Because the name is not a valid identifier, it cannot be used directly in a program written in the Java programming language.

That’s why <init> can be found on the stack trace, but is not accessible with code.

Leave a Comment