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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
mutley
Posts: 6
Joined: Mon Feb 23, 2015 9:37 am
Contact:

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

Post by mutley »

your correct answer looks like this :


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

you have omitted one bracket ...

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Very sorry, but it looks ok to me :(

flex567
Posts: 202
Joined: Mon Apr 02, 2018 8:40 am
Contact:

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

Post 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?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

flex567
Posts: 202
Joined: Mon Apr 02, 2018 8:40 am
Contact:

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

Post by flex567 »

aha I see. I just coundt see those charachters in my text editor.
Attachments
Capture.PNG
Capture.PNG (59.51 KiB) Viewed 1850 times

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests