1.

What is the outcome of below code box class?
class Shape 
{
public int area()
{
return 0;
}
}

class Square extends Shape
{
public int area()
{
return 5;
}
}

class Rectangle extends Shape
{
public int area()
{
return 9;
}
}

public class box
{
public static void main(String[] args)
{
Shape obj = new Square();
Shape obj0 = new Rectangle();
obj = obj0;
System.out.println(obj.area());
}
}

A. Compilation Error
B. Runtime Error
C. Default value
D. 9
E. None of these
Answer» E. None of these


Discussion

No Comment Found

Related MCQs