Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 24th, 2006, 7:54 AM   #1
tumbleTetris
Programmer
 
Join Date: May 2006
Posts: 39
Rep Power: 0 tumbleTetris is on a distinguished road
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();
        }
    }
}
tumbleTetris is offline   Reply With Quote
Old May 24th, 2006, 8:08 AM   #2
Toro
Hobbyist Programmer
 
Toro's Avatar
 
Join Date: Apr 2006
Posts: 136
Rep Power: 0 Toro is an unknown quantity at this point
[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".
Toro is offline   Reply With Quote
Old May 24th, 2006, 8:14 AM   #3
tumbleTetris
Programmer
 
Join Date: May 2006
Posts: 39
Rep Power: 0 tumbleTetris is on a distinguished road
yeah, I see. Thanks
tumbleTetris is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC