public class Foo {
public void Foo() {
System.out.println("ctor?");
}
}
// ...
Foo f = new Foo();What happens?
- Acheck_circle
Nothing is printed; Java's default constructor was used
- B
Run-time error
- C
Compile-time error
- D
ctor? is printed
Explanation
Foo here is a regular method (it has return type void), not a constructor; the implicit default constructor runs and produces no output.