Friday, 10 May 2013

Constructor - 12 -


Consider the following class declaration:Which of the following calls are legal to construct an instance of the Test class?


package net.dharmaraj;

public class Test
{
    public Test(double i)
    {
    }

    public void Test()
    {
    }

    public Test(int i, int j)
    {
    }

    public static void main(String[] x)
    {

        // here

    }
}




Choose answer(s)
a)Test t = new Test(1,2);  
b)Test t = new Test(1);  
c)Test t = new Test(1.0);  
d)Test t = new Test();

No comments:

Post a Comment