This is a legitimate (albeit confusing) method with the same name as the class, new
eliminates any ambiguity. new
indicates that the JVM should call the instance initialization method for the given list of classes and arguments and return an initialized object (which is referenced by the first (hidden) parameter of the initialization method).
Java designers could probably find an alternative syntax, but they had a design goal that any time memory was allocated on the heap, it must be called explicitly, requiring the new
keyword. This probably seems strange, but most of the Java target audience were C and C ++ programmers who were suspicious of garbage collection, this was done so that the developers did not have allocated memory without their knowledge.
source share