Is there a way to do arithmetic on Integer objects? For example, I tried the following without success:
Integer I = new Integer(1);
I++;
I also noticed there is no setValue(int) method in the Integer class, so I can't do this:
I.setValue(I.intValue() + 1);
The only way I can think of to change the value of an Integer (or any Number object) through arithmetic is to create a new one based on the value of the old one. So something like this:
I = new Integer(I.intValue() + 1);
Is this really the only way to do it?