Here’s what I’ve been trying to do, in a nutshell:
class example <T extends Number> { private int function(T number) { int x = (int) number; ... } ... }
Basically, I’m trying to make it so that T is a number so I can convert it to an int inside that function. The problem is that I’m getting an ‘incovertible types’ error, so I must be doing something wrong.
Considering that the abstract class
Numberis the superclass of classes *BigDecimal,BigInteger, *Byte,Double,Float, *Integer,Long, andShort…if you want to have an int representation, you should use the
.intValue()function.If that is what you want to do.