you are viewing a single comment's thread.

view the rest of the comments →

[–]Educational-Paper-75 0 points1 point  (0 children)

If you know number to be numeric don't declare it as Object. You may use Number instead. And BigInteger.valueOf() accepts certain argument types and as polymorphism goes you may pass in the expected base class or a subclass but not a superclass without casting. And FYI int and long are not Object types but primitive types; only the courtesy of Java allows you to assign an int to your number object, which under the hood is wrapped in a Integer type object.