brian Chiem
brian Chiem

Reputation: 245

Array compare string

Hi im trying to figure out why my code isn't doing what i want it to do. when i run the code it always does the if statement in the for loop. i changed the logic around but it always does the for loop all the time. im not sure why . thanks for the help

            for (int col =0; col< s ; col++){
        System.out.print(col+ ": ");
        for (int row = 0; row<s; row++)
        {
            x=val[row][col];
            if (table[row][col]==row)
            {
                System.out.print(x+1);
            }
            //System.out.print(val[col][row]+" ");
            if (row+1==s)
                System.out.println();
        }
    }

Upvotes: 0

Views: 71

Answers (1)

Abi
Abi

Reputation: 1345

You have a semicolon at the end of the if statement, remove it.

 if (x==2);

Upvotes: 3

Related Questions