Use a Number Bound on a Generic Class
easyQuestion 500NumberBox<T extends Number> only accepts numeric types such as Integer, Double and Long. The bound extends Number matters inside the class too: it lets you call the methods of Number on the stored value, for example doubleValue(). Complete the two methods that do so.
Requirements:
1. doubled() returns twice the stored number as a double.
2. isPositive() returns true when the stored number is greater than zero, otherwise false.
3. Read the number with value.doubleValue() in both methods.
Do NOT write a main method.
Expected output
42.0 2.5 true 21
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
GenericsClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.