Java Programming Language Overriding and Overloading in Java
⚠ Report Question ✓ Question Verified
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)); } }
Learn More MCQ Questions from Java Programming Language Overriding and Overloading in Java
Evaluate your knowledge of Java overriding and overloading with these multiple choice questions. Learn about the difference between the two concepts and how to use them to create more flexible and efficient Java programs. Take the quiz now!