143k views
2 votes
Consider the following first line from a Java method definition.

public static boolean compute(int n, float x) {

Which one of the following lines could begin a method that legally overloads the above method?

a. private static boolean compute(int n, float x) {
b. public boolean compute(int n, float x) {
c. public static int compute(int n, float x) {
d. public static boolean compute(float n, int x) {
e. public static boolean compute(int x, float n) {

User Ran Turner
by
4.1k points

1 Answer

9 votes

Answer:

d.

Step-by-step explanation:

The line of code that would legally overload the above method would be

public static boolean compute(float n, int x) {

This is because in order to legally overload a method the arguments that are passe

User Kurohige
by
4.1k points