Coding Global Background
Coding Global

ap csa java question

Archiviert 2 years ago
4 Nachrichten
0 Mitglieder
Erstellt 2 years ago
Aktualisiert 2 years ago
In Discord öffnen
T
techno
 class Overload

{

public int average(int x, int y)

{ /* implementation not shown */ }

 

public int average(int value1, int value2)

{ /* implementation not shown */ }

 

// There may be instance variables, constructors,

// and methods that are not shown.

}

II.

public class Overload

{

public int average(int x, int y)

{ /* implementation not shown */ }

 

public int average(int x, int y, int z)

{ /* implementation not shown */ }

 

// There may be instance variables, constructors

// and methods that are not shown.

}

III.

public class Overload

{

public int average(int x, int y)

{ /* implementation not shown */ }

 

public int average(double x, double y)

{ /* implementation not shown */ }

 

// There may be instance variables, constructors,

// and methods that are not shown.

}


Which of the attempts at method overloading will compile without error?

A
I only

B
II only

C
III only

D
II and III only

E
I, II, and III

The answer is D I dont understand why 3 will compile since the paramters in the average method are different data types

Antworten (4)