Friday, 10 May 2013

Constructor - 5 -


Given the following class definition which of the following can be legally placed after the comment line.



package net.dharmaraj;

class Base
{
    public Base(int i)
    {
    }

}


public class MyOver extends Base

{
    public static void main(String arg[])
    {
        MyOver m = new MyOver(10);
    }

    MyOver(int i)

    {
        super(i);
    }

    MyOver(String s, int i)

    {
        this(i);
        // Here

    }


}






1)MyOver m = new MyOver();

2)super();
3)this("Hello",10);
4)Base b = new Base(10);

No comments:

Post a Comment