Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1400 :

Posted: Thu Feb 26, 2015 7:09 pm
by mutley
your correct answer looks like this :


for(String[] row : table)
{     System.out.print(row[row.length-1]); }

you have omitted one bracket ...

Re: About Question enthuware.ocajp.i.v7.2.1400 :

Posted: Thu Feb 26, 2015 9:00 pm
by admin
Very sorry, but it looks ok to me :(

Re: About Question enthuware.ocajp.i.v7.2.1400 :

Posted: Sat Dec 22, 2018 8:04 am
by flex567
When I try to run this program I get these errrors:

Code: Select all

public class Test{
	
    static String[][] table;
    public static void main(String[] args) {
        String[] x = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
        String[] y1 = { "1", "2", "3", "4", "5" };
        String[] y2 = { "a", "b", "c" };
        
        table = new String[3][];
        table[0] = x;
        table[1] = y1;
        table[2] = y2;

        for(int i=0; i<table.length-1; i++)	{     
			int j = table[i].length-1;     
			System.out.print(table[i][j]); 
		}

    }
}
Errors:

Code: Select all

Test.java:14: error: illegal character: '\u00a0'
        for(int i=0; i<table.length-1; i++)	{     
                                           	   ^
Test.java:14: error: not a statement
        for(int i=0; i<table.length-1; i++)	{     
                                           	  ^
Test.java:14: error: illegal character: '\u00a0'
        for(int i=0; i<table.length-1; i++)	{     
                                           	     ^
Test.java:14: error: not a statement
        for(int i=0; i<table.length-1; i++)	{     
                                           	    ^
Test.java:14: error: illegal character: '\u00a0'
        for(int i=0; i<table.length-1; i++)	{     
                                           	       ^
Test.java:14: error: not a statement
        for(int i=0; i<table.length-1; i++)	{     
                                           	      ^
Test.java:14: error: illegal character: '\u00a0'
        for(int i=0; i<table.length-1; i++)	{     
                                           	         ^
Test.java:14: error: not a statement
        for(int i=0; i<table.length-1; i++)	{     
                                           	        ^
Test.java:15: error: illegal character: '\u00a0'
			int j = table[i].length-1;     
			                            ^
Test.java:15: error: not a statement
			int j = table[i].length-1;     
			                           ^
Test.java:15: error: illegal character: '\u00a0'
			int j = table[i].length-1;     
			                              ^
Test.java:15: error: not a statement
			int j = table[i].length-1;     
			                             ^
Test.java:15: error: illegal character: '\u00a0'
			int j = table[i].length-1;     
			                                ^
Test.java:15: error: not a statement
			int j = table[i].length-1;     
			                               ^
Test.java:15: error: illegal character: '\u00a0'
			int j = table[i].length-1;     
			                                  ^
Test.java:15: error: not a statement
			int j = table[i].length-1;     
			                                 ^
16 errors
Why the errors here?

Re: About Question enthuware.ocajp.i.v7.2.1400 :

Posted: Sat Dec 22, 2018 11:01 am
by admin
Delete those junk chars.
Or, instead of selecting the code on the question screen through mouse, do a right click on it and the select Copy Source menu item.

Re: About Question enthuware.ocajp.i.v7.2.1400 :

Posted: Sat Dec 22, 2018 4:50 pm
by flex567
aha I see. I just coundt see those charachters in my text editor.