...
Code Block | ||
---|---|---|
| ||
<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 | ||
---|---|---|
| ||
double sum(Number... args) { // ... } |
Compliant Solution (
...
Generic Type)
This compliant solution defines the same generic method using the Number
type.
...