How do I add an Integer to another Integer?

Discussion in 'Java' started by Sebastian Stelzer, Oct 14, 2004.

  1. 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

    --
    Java rockz!
     
    Sebastian Stelzer, Oct 14, 2004
    #1
    1. Advertising

  2. Sebastian Stelzer <> scribbled the following:
    > 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 () ------------- 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
     
    Joona I Palaste, Oct 14, 2004
    #2
    1. Advertising

  3. Sebastian Stelzer

    Yu SONG Guest

    Sebastian Stelzer wrote:
    > 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/
    _______________________________________________________
     
    Yu SONG, Oct 15, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9l?=

    CType(x,Integer) vs. Integer.Parse(x)

    =?Utf-8?B?Sm9l?=, Feb 6, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    5,990
    =?Utf-8?B?RGF2aWQgQW50b24=?=
    Feb 7, 2006
  2. =?ISO-8859-1?Q?Thomas_Gagn=E9?=

    No Math.min(Integer, Integer)?

    =?ISO-8859-1?Q?Thomas_Gagn=E9?=, Jul 29, 2003, in forum: Java
    Replies:
    0
    Views:
    542
    =?ISO-8859-1?Q?Thomas_Gagn=E9?=
    Jul 29, 2003
  3. Sebastian Stelzer

    How do I add an Integer to another Integer?

    Sebastian Stelzer, Oct 14, 2004, in forum: Java
    Replies:
    6
    Views:
    45,956
    JavaBean2010
    Apr 7, 2010
  4. Johannes Zellner
    Replies:
    22
    Views:
    3,768
  5. les ander
    Replies:
    4
    Views:
    924
    wes weston
    Oct 5, 2004
Loading...

Share This Page