![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2006
Posts: 39
Rep Power: 0
![]() |
illegal start of expression, required ) ?
something is wrong with this code, and I don't know what it is:
import java.util.*;
public class MultiArrays {
public static void main(String[] args) {
int[][] table = new int[10][8];
int row;
int column;
int x = 0;
//Creates 2D array and stores values within it
for ( row = 0; row < 10; row++ ) {
for ( column = 0; column < table[row].length; column++ ) {
table[row][column] = x++;
}
}
//prints the 2D array
for ( row = 0; row < 10; row++ ) {
for (column = 0; column < 6; column++) {
if (table[row][column] < 10)
{
System.out.print(table[row][column] + " ");
}
if ( table[row][column] => 10 )
{
System.out.print(table[row][column] + " ");
}
}
System.out.println();
}
}
} |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Apr 2006
Posts: 136
Rep Power: 0
![]() |
[PHP]
import java.util.*; public class MultiArrays { public static void main(String[] args) { int[][] table = new int[10][8]; int row; int column; int x = 0; //Creates 2D array and stores values within it for ( row = 0; row < 10; row++ ) { for ( column = 0; column < table[row].length; column++ ) table[row][column] = x++; } //prints the 2D array for ( row = 0; row < 10; row++ ) { for (column = 0; column < 6; column++) { if (table[row][column] < 10) System.out.print(table[row][column] + " "); else if ( table[row][column] >= 10 ) System.out.print(table[row][column] + " "); } System.out.println(); } } } [/PHP] You had you "<=" the wrong way, you put "=>", thats not the way it should be, its the reverse order. It's called "Greater than or Equal to", not "Equal to or Greater than". |
|
|
|
|
|
#3 |
|
Programmer
Join Date: May 2006
Posts: 39
Rep Power: 0
![]() |
yeah, I see. Thanks
![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|