Results 1 to 3 of 3
  1. #1
    and0rsk is offline Member
    Join Date
    Oct 2010
    Posts
    6
    Rep Power
    0

    Default Type Mismatch error

    I keep getting a type mismatch. Could someone explain why? also i++ considered a dead code??

    sorry made a small error before in typing code.
    public static boolean contains(int[] A, int int1){
    for (int i = 0; ,i < A.length; i++) {
    if (int1 == A[i])
    return true;
    }
    else {return false;}
    }
    }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by and0rsk View Post
    I keep getting a type mismatch. Could someone explain why? also i++ considered a dead code??

    sorry made a small error before in typing code.
    public static boolean contains(int[] A, int int1){
    for (int i = 0; ,i < A.length; i++) {
    if (int1 == A[i])
    return true;
    }
    else {return false;}
    }
    }
    Don't start multiple threads for the same small snippet of code; your compiler tells you what's wrong with it; read those error messages.

    kind regards,

    Jos

  3. #3
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    335
    Rep Power
    4

    Default

    and0rsk,

    Java Code:
    for(int i = 0; ,i < A.length; i++)

    should read...

    Java Code:
    for(int i = 0; i < A.length; i++)

    Regards.

Similar Threads

  1. printable area mismatch between Java & C++ possible?
    By r00tb33r in forum AWT / Swing
    Replies: 0
    Last Post: 06-16-2010, 06:29 AM
  2. Replies: 6
    Last Post: 02-21-2010, 12:54 AM
  3. Error: unexpected type
    By silvia in forum New To Java
    Replies: 3
    Last Post: 02-05-2010, 09:54 PM
  4. Replies: 0
    Last Post: 11-27-2008, 12:25 PM
  5. Replies: 2
    Last Post: 11-16-2007, 01:24 PM

Posting Permissions

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