This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, These questions are from Jxam mock exam and i think given answers are not correct. Q#1 Choose the class that can hold multiple equal objects in an ordered way. A. Map B. Collection C. List D. Set E. Vector Given answer is 'C' but List is not a class, it is a interface. Vector is a class that implements List interface. i think answer should be 'E'.
Q#2 Given the following definition: String s = null;
Which code fragment will cause an exception of type NullPointerException to be thrown. A. if ((s != null) & (s.length()>0)) B. if ((s != null) && (s.length()>0)) C. if ((s != null) | (s.length()>0)) D. if ((s != null) | | (s.length()>0)) Given answer are 'A','B','C','D'. but i think 'B' is not correct ( LHS will give u false then RHS will not be executed). Q#3 Which of the following are defined in the Object class? A. toString() B. equals(Object o) C. public static void main(String arg) D. System.out.println() E. wait() given answer are 'B' and 'E'. what is wrong with 'A'? please do verify. vivek [This message has been edited by Vivek Shrivastava (edited August 05, 2000).] [This message has been edited by Vivek Shrivastava (edited August 06, 2000).]
Q#1 :The elements in vector are not ordered. If they just say List class, the only List class we have is java.awt.List.Probably, the question should be rephrased. Q#2 : you are right. Q#3 : you are right.
[This message has been edited by vasansrini (edited August 05, 2000).]
Joined: Nov 22, 2008
Vivek, Why do you think that the answer to question 1 should be 'D'. Even Set is an interface. In fact except Vector, all the other possible alternatives are interfaces. Rgds, Shashank