//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class K
{
K(boolean b)
{
System.out.println("K(Boolean)");
}
K(int i)
{
System.out.println("K(int)");
}
public static void main(String[] args)
{
K K1 = new K(10);
System.out.println("------");
K K2 = new K(true);
System.out.println("------");
}
}
12. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class L
{
L(int i,int j)
{
System.out.println("L(int , int)");
}
L(int i, double j)
{
System.out.println("L(int , double)");
}
public static void main(String[] args)
{
L L1 = new L(10, 20);
System.out.println("------");
L L2 = new L(10, 30.66);
System.out.println("------");
}
}
13. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class M
{
M(int i)
{
System.out.println("M(int)");
}
public static void main(String[] args)
{
M M1 = new M(10);
System.out.println("------");
M M2 = new M();
System.out.println("------");
}
}
14. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class S
{
S()
{
System.out.println("S()");
}
S(int i)
{
S(10);
System.out.println("S(int)");
}
public static void main(String[] args)
{
S s1 = new S();
System.out.println("------");
S s2 = new S(10);
System.out.println("------");
}
}
15. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class T
{
T()
{
System.out.println("T()");
}
T(int i)
{
T t2 = new T();
System.out.println("T(int)");
}
public static void main(String[] args)
{
T t1 = new T(); // first const. is called
System.out.println("------");
T t2 = new T(10);
System.out.println("------");
}
}