Because C ++ did it this way, I suppose. It was supposed that Java should look superficially, like C ++, but with a very simplified and simplified language.
Anyway you have a problem:
class Foo {
private static void A() {
System.out.println("method");
}
public static void main(String[] args) {
A();
}
}
class A {
public A() {
System.out.println("ctor");
}
}
What is going to happen here? ctoror method?
source
share