Results 1 to 5 of 5
  1. #1
    MICHAELABICK is offline Member
    Join Date
    Nov 2008
    Posts
    2
    Rep Power
    0

    Default Error Message: operator * cannot be applied to java.lang.String, int

    I have gotten the error message operator * cannot be applied to java.lang.String, int. The statment that has the error is posted below. Can anyone tell me how to fix it?

    int answer = num1 * num2;

    Please help me! Thank you.

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    How did you declare the num1 and num2?

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by serjant View Post
    How did you declare the num1 and num2?
    Seems it's not the type of an int. Can you show your declaration MICHAELABICK on num1 and num2.

  4. #4
    Deepa is offline Member
    Join Date
    Nov 2008
    Posts
    85
    Rep Power
    0

    Default Re:Error Message: operator * cannot be applied to java.lang.String ...

    Hi,
    How to declare num1 and num2.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Deepa View Post
    Hi,
    How to declare num1 and num2.
    What you mean here? Looking that how to declare a variable? If you don't know I think it's better get hands dirty with Java basis.

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 03:12 AM
  2. Replies: 2
    Last Post: 09-18-2008, 08:30 AM
  3. Error: cannot be applied to (java.lang.String)
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 07:33 AM
  4. Replies: 1
    Last Post: 08-02-2007, 05:07 PM
  5. Replies: 1
    Last Post: 08-01-2007, 07:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •