Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
<T> double sum(T... args) {
  // ...
}

Compliant

...

Solution (Number)

This compliant solution defines the same method, but uses the Number type. This abstract class is general enough to encompass all numeric types, yet specific enough to exclude non-numeric types.

Code Block
bgColor#ccccff
double sum(Number... args) {
  // ...
}

Compliant Solution (

...

Generic Type)

This compliant solution defines the same generic method using the Number type.

...