This is NOT homework.
Is it possible to write a generic method, something like this:
FWIW this isn't really a limitation of generics.
The + operator only works on primitives. The reason it works for Integer or Long is because of autoboxing/unboxing with their primitive types. Not all Number subclasses have a matching primitive type, but more importantly Number doesn't have a matching primitive type. So taking generics out of it completely, the following code would still be wrong:
public Number plusOne(Number num) {
return num + 1;
}