iRix Technolohies mock questions
Problem 1
Given the following class declarations in their respective files
What is the result of compiling & running class Circle ?
correct answer: Prints 10 to the console.
wrong answer:Prints 20 to the console.
shouldn't answer be 20 since 20 would override 10
---------------------------------------------
Problem 2
Given the following, what is the result of compiling & running class
Test ?
options:
A.Compiler error, reference to render is ambiguous.
B.AmbiguousReferenceException thrown at runtime.
C.Prints "render(Shape s, Circle c)" to the console.
D.Prints "render(Circle c, Shape s)" to the console.
correct answer is
D.
i think answer should be A
as we are passing
new Circle,new Circle to
render(c1, s1);method because
both the method match,so complier erroe