Bert Bates wrote:Hi Guys,
First off, thanks for taking the time to post these errata!
Second, I'd like to request that before an entry goes on this list, it's discussed in a separate thread - to be sure it's actually an error.
Thanks,
Bert
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Exception in thread "main" java.lang.NoClassDefFoundError: myApp/Foo
at GetJar.main(GetJar.java:3)
Caused by: java.lang.ClassNotFoundException: myApp.Foo
...
Page xxxi states there are 72 questions on the exam and you need to get 47 of them correct to pass. On the exam I took there were only 60 questions
Question 7 :
Given:
3. public class Bridge {
4. public enum Suits {
5. CLUBS(20), DIAMONDS(20), HEARTS(30), SPADES(30),
6. NOTRUMP(40) { public int getValue(int bid) {
return ((bid - 1) * 30) + 40;} };
7. Suits(int points) { this.points = points;}
8. private int points;
9. public int getValue(int bid) {return points * bid;}
10. }
11. public static void main(String[] args) {
12. System.out.println(Suits.NOTRUMP.getBidValue(3));
13. System.out.println(Suits.SPADES + " " + Suits.SPADES.points);
14. System.out.println(Suits.values());
15. }
16. }
Which are true? (Choose all that apply.)
A. The output could contain 30
B. The output could contain @bf73fa
C. The output could contain DIAMONDS
D. Compilation fails due to an error on line 6
E. Compilation fails due to an error on line 7
F. Compilation fails due to an error on line 8
G. Compilation fails due to an error on line 9
H. Compilation fails due to an error within lines 12 to 14
Answer:
- A and B are correct. The code compiles and runs without exception. The values()
method returns an array reference, not the contents of the enum, so DIAMONDS is never
printed.
- C, D, E, F, G, and H are incorrect based on the above. (Objective 1.3)
Sarah wrote:Page 803 defines a jar called MyJar.jar but page 804 refers to a jar myApp.jar, which is presumably meant to be the same jar.
Sarah wrote:I took "system classpath" to mean something like jre/lib/ext which is not overridden.
Sarah wrote:Page 798 states "When searching for class files, the java and javac commands don't search the current directory by default".
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
No cast is needed in this case because d double can hold every piece of information that a long can store.
Alexander Exner wrote:Some misleading code on Page 579
does the job as well. To set the length of ia2 to 3 may cause somebody thinking its necessary to create an array of the same size first.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
[...] it comes in two flavors: one that returns a new Object array, and one that uses the array you send it as the destination array:
Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.
If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)
The behavior of a sorted map is well-defined even if its ordering is inconsistent with equals; it just fails to obey the general contract of the Map interface.
Space pants. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|