Hello!
It seems there's an error in the Enthware JA+ V7 test - it's in the Q18 of LastDayExam:
Given:
import java.util.*;
public class TestClass {
public static void main(String[] args) throws Exception {
ArrayList<Double> al = new ArrayList<>();
//INSERT CODE HERE
}
}
What can be inserted in the above code?
you have to select 3 options:
1. al.add(111);
2. System.out.println(al.indexOf(1.0));
3. System.out.println(al.contains("string"));
4. Double d = al.get(al.length);
5. al.notifyAll();
The corrent answers (by your version) are 2, 3 and 5.
But it seems to me 5 is not suited here.
The program will compile with line at 5 inserted, but it will throw IllegalMonitorStateException, because notyfyAll() method should be called within a synchronized context.
In order to be the 5 option correct the answer should be something like:
What can be inserted in the above code, so it will compile without a problem?
Currently, the question is too vague to give a certain answer.
About Question enthuware.ocajp.i.v7.2.925 :
Moderators: Site Manager, fjwalraven
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.925 :
You are right. The question should make it clear that it is only talking about compilation. This has now been fixed.
Thank you for your feedback!
Thank you for your feedback!
Who is online
Users browsing this forum: No registered users and 17 guests