132k views
2 votes
A programmer writing code in class Point attempts to override the following inherited method:public boolean equals( Object o ) { ... }but does not match the method signature exactly. Instead, the programmer uses the following method signature:public boolean equals( Point p ) { ... }What is the result?a. A syntax error occurs because the method signatures do not match.b. The code compiles and works fine -- the method has been successfully overridden.c. The code compiles, but the inherited method has not been overridden -- it has been overloaded instead.d. The compiler automatically changes the method signature to match the inherited method.e. The compiler issues a warning, but the method is successfully overridden.

1 Answer

4 votes

Answer:

a. A syntax error occurs because the method signatures do not match.

Step-by-step explanation:

The method signature does not match as the method argument is wrong and so the compiler would issue a syntax error. Trying to override an inherited method from a class and not getting the method syntax correct would mean that the overide operation would not be successful as there would be a syntax error therefore it is paramount that the method argument is properly inputted in the above statement in order to successfully overide the inherited class method.

User Shreyes
by
6.7k points