How do I add an Integer to another Integer?

S

Sebastian Stelzer

Hi!
I have a question.
The Javacompiler printed this error message to the screen, while
I was compiling my source file:
<output>
calcit2004.java:77: operator + cannot be applied to
java.lang.Integer,java.lang.Integer
iTmp3 = String.valueOf(iTmp1 + iTmp2);
^
</output>
I don't know, why this is a wrong code.
How can I solve this problem?
Thanks
 
J

Joona I Palaste

Sebastian Stelzer said:
Hi!
I have a question.
The Javacompiler printed this error message to the screen, while
I was compiling my source file:
<output>
calcit2004.java:77: operator + cannot be applied to
java.lang.Integer,java.lang.Integer
iTmp3 = String.valueOf(iTmp1 + iTmp2);
^
</output>
I don't know, why this is a wrong code.
How can I solve this problem?
Thanks

iTmp3 = String.valueOf(iTmp1.intValue() + iTmp2.intValue());

--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"'It can be easily shown that' means 'I saw a proof of this once (which I didn't
understand) which I can no longer remember'."
- A maths teacher
 
Y

Yu SONG

Sebastian said:
Hi!
I have a question.
The Javacompiler printed this error message to the screen, while
I was compiling my source file:
<output>
calcit2004.java:77: operator + cannot be applied to
java.lang.Integer,java.lang.Integer
iTmp3 = String.valueOf(iTmp1 + iTmp2);
^
</output>
I don't know, why this is a wrong code.
How can I solve this problem?
Thanks

You can also try *java.math.BigInteger*

--
Song

/* E-mail.c */
#define User "Yu.Song"
#define At '@'
#define Warwick "warwick.ac.uk"
int main() {
printf("Yu Song's E-mail: %s%c%s", User, At, Warwick);
return 0;}

Further Info. : http://www.dcs.warwick.ac.uk/~esubbn/
_______________________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,302
Latest member
endevsols

Latest Threads

Top