//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class M
{
M()
{
System.out.println("Class M()");
}
}
class N extends M
{
N()
{
System.out.println("Class N()");
}
}
class O
{
public static void main(String[] args)
{
M m1 = new M();
System.out.println("------");
M n1 = new N();
System.out.println("------");
O o1 = new O();
System.out.println("------");
}
}
6. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class P
{
}
class Q extends P
{
}
class R{
public static void main(String[] args){
Q q1 = new Q();
System.out.println("------");
P p1 = new P();
System.out.println("------");
}
}
7. Program
UNDERSTAND IT STEP BY STEP
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class V
{
V(int i)
{
System.out.println("V()");
}
}
class W extends V
{
W(int i)
{
System.out.println("R()");
}
public static void main(String[] args)
{
V v1 = new V(10);
System.out.println("------");
W w1 = new W(10);
System.out.println("------");
}
}
8. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class X
{
{
System.out.println("x");
}
}
class Y extends X
{
Y(int i)
{
System.out.println("Y(int)");
}
public static void main(String[] args)
{
Y y1 = new Y(10);
System.out.println("------");
}
}