0
This is a matter of the simulated java certification of the Whizlabs site.
public class Whizlabs {
public static void main(String[] args) {
int[] testData = {1, 2, 3};
for(abc){
}
}
}
The question is as follows: "Choose the option can replace the text "abc" in the above code." (Select 2 options)
To. int i : testData
B. int i = 0; i < 1; i++
C. i++
D. ;i++; 1 < 1;
And. ;i < 1; 0
The correct answer is the letter "A" and "B". Why? I didn’t understand the answer.
You know how one works
for
? What is afor
? Do you understand his syntax? You doubt what?– Maniero
In case the question is just asking to go through the arrays using for, is that it? Because the letter "B" should not be
i <= 1
ori < 2
?– Edson F.
That’s what it looks like, even though I didn’t do anything useful, I would compile, the other three options.
– Maniero
Now I understand, so there is no need to go through the whole array, so the part of the letter "B"
i<1
is correct, because I would compile normally. In the end the only mistake was my lack of attention. Thank you– Edson F.
In fact, it seems to me that they just want to know which ones have the right syntax, since they don’t have a definite goal, just something that can be put that will work in some way. There’s a lot of question is that even more understand it than the knowledge itself.
– Maniero