Single Choice
Not Set
QWhat will be the output of the following program 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);
}
}
public class Test{
public static void main(String args[]){
Square r = new Square();
System.out.println(r.area(5 , 4));
}
}
ID: #2239
Overriding and Overloading in Java
1,525 views
Question Info
#2239Q ID
Not SetDifficulty
Overriding and Overloading in JavaTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
Will compile and run printing out 20
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic