1.

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

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

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

A. 6
B. Runtime Error
C. Default Value
D. Compilation Error
E. None of these
Answer» B. Runtime Error


Discussion

No Comment Found

Related MCQs