1.

What is the outcome of below Square_Shape_Example class?
class Shape 
{
public int area()
{
return 1;
}
}

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

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

A. 0
B. Compilation Error
C. Runtime Error
D. Default value
E. 5
Answer» F.


Discussion

No Comment Found

Related MCQs