//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class O
{
O()
{
System.out.println("O()");
}
{
System.out.println("O-IIB");
}
}
class P extends O
{
{
System.out.println("P-IIB");
}
P(int i)
{
System.out.println("P(int-i)");
}
public static void main(String[] args)
{
O o1 = new O();
System.out.println("------");
P p1 = new P(10);
System.out.println("------");
}
}
12. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class Q
{
Q()
{
System.out.println("Q()");
}
{
System.out.println("Q-IIB");
}
}
class R extends Q
{
{
System.out.println("R-IIB");
}
R()
{
System.out.println("R()");
}
}
class S extends R
{
S(int i)
{
System.out.println("S(int i)");
}
{
System.out.println("S-IIB");
}
public static void main(String[] args)
{
S s1 = new S(10);
System.out.println("------");
R r1 = new R();
System.out.println("------");
Q q1 = new Q();
System.out.println("------");
}
}
13. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class T
{
{
System.out.println("T-IIB1");
}
T()
{
System.out.println("T()");
}
{
System.out.println("T-IIB2");
}
}
class U extends T
{
U()
{
System.out.println("U()");
}
}
class V extends U
{
V()
{
this(10);
System.out.println("V()");
}
{
System.out.println("V-IIB");
}
V(int i)
{
System.out.println("V(int i)");
}
public static void main(String[] args)
{
T t1 = new T();
System.out.println("------");
U u1 = new U();
System.out.println("------");
V v1 = new V();
System.out.println("------");
V v2 = new V(20);
System.out.println("------");
}
}