About Question enthuware.ocajp.i.v8.2.897 :

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

Moderator: admin

Post Reply
ghassenkhalil
Posts: 1
Joined: Sun Dec 02, 2018 5:07 pm
Contact:

About Question enthuware.ocajp.i.v8.2.897 :

Post by ghassenkhalil »

I didn't understand what's it's asked by this question !

Code: Select all

Given the following code :

public class TestClass {

    int[][] matrix = new int[2][3];
    
    int a[] = {1, 2, 3};
    int b[] = {4, 5, 6};
            
    public int compute(int x, int y){
        //1 : Insert Line of Code here
    }
    
    public void loadMatrix(){
        for(int x=0; x<matrix.length; x++){
            for(int y=0; y<matrix[x].length; y++){
                //2: Insert Line of Code here
            }
        }
    }
}
What can be inserted at //1 and //2?

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

Re: About Question enthuware.ocajp.i.v8.2.897 :

Post by admin »

The code listing contains two places (marked //1 and //2 ) where you need to insert the code fragments to make the given code listing compile.
Code fragments are given in the options. You have to identify which option makes sense.
If you like our products and services, please help us by posting your review here.

aomk_17
Posts: 4
Joined: Thu Feb 04, 2021 10:48 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.897 :

Post by aomk_17 »

admin wrote:
Sun Dec 02, 2018 8:47 pm
The code listing contains two places (marked //1 and //2 ) where you need to insert the code fragments to make the given code listing compile.
Code fragments are given in the options. You have to identify which option makes sense.
The code won't compile with the two member variables having var as their type. Is it just meant to throw us off or was making them var accidental?

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

Re: About Question enthuware.ocajp.i.v8.2.897 :

Post by admin »

You are right. Those should be declared as int[] and not as var. Fixed.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests