How to add two java.lang.Numbers?

Posted by amit.dev on Stack Overflow See other posts from Stack Overflow or by amit.dev
Published on 2010-04-27T13:05:44Z Indexed on 2010/04/27 13:13 UTC
Read the original article Hit count: 319

Filed under:
|

I have two Numbers. Eg:

Number a = 2;
Number b = 3;
//Following is an error:
Number c = a + b;

Why arithmetic operations are not supported on Numbers? Anyway how would I add these two numbers in java? (Of course I'm getting them from somewhere and I don't know if they are Integer or float etc).

© Stack Overflow or respective owner

Related posts about java

Related posts about basic