What will happen if you try to compile and run this code.
class Rectangle{
public int area(int length , int width) {
return length * width;
}
}
class Square extends Rectangle{
public int area(long length , long width) {
return (int) Math.pow(length ,2);
}
}
class Test{
public static void main(
String args[]) {
Square r = new Square();
System.out.println(r.area(5 , 4));
}
}
1. Will not compile.
2. Will compile and run printing out 20
3. Runtime error
4. Will compile and run printing out 25
the right answer is :1 how??? i can't get it