Why the compiler doesn't complain about this error ?
- by M.H
Hi
I am writing some java questions to help my friends in
the java exam. I wrote a question and I supposed
that three errors will occurred in the code but the compiler
complained only about two. the code is :
class MyClass
{
static MyClass()
{
System.out.println("I am The First Statement here!");
this();
}
}
I expected the following errors :
the constructor can't be static
this can't be in a static function (since the constructor isn't valid)
this here should be the first
statement.
NetBeans isn't complaining about the second error here. why ?