Q: If, when defining a class, we don’t define its constructor, the compiler implicitly assigns one. However, if we do define a constructor, the compiler interprets this as function overriding and does not flash an error. But if this is the case, why do I receive a compiler error in example 3 below?
Example 1:
class x
{
int x,y;
public void x( ) // The compiler considers this method overriding.
{
}
}
public static void main(String arg[])
{
x x1=new x() // No error.
}