• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some minor typos in chapter 4 (Java OCA 8 Programmer I Study Guide)

 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally I start to write codes in notepad after some important advice. Although there are some difficulties but it is a very enjoyable After I write code in notepad I compile it with javac and run with java ClassName in cmd. But if I want to make minor change for testing I copy codes to Netbeans and check it there. I don’t know this way is correct or not.
The following first note which I wrote in notepad doesn’t compile with javac.

1. On page 210, the second example, TraditionalSearch class doesn’t compile:
Text Editor helped me to see that this class doesn’t compile so import java.util.*; is missing. The line starts 1 therefore it should be import or line shouldn’t start 1. If line numbers change that line 9 and line 11 change respectively (in the explanation after example).

2. On page 215, example code, import is missing again:
The line starts 3. If line 1 is class name and line 2 is method declaration, import java.util.*; is missing again.

3. On page 216, “Summary” section, the last paragraph:
should be: or
Review questions
4. On page 222, question #11:
Space ( “ “ ) is missing after “climb climb” and “swing swing” in option D and E. “swing swing” should be “swing swing ” but option D is not important.

5. On page 226, question #19:
Option G:
should be: 6. On page 229, question #25:
Space ( “ “ ) is missing in all options. Option A (maybe E) is important, “2 4” should be “2 4 ”.

Mock explanation
7. On page 344, answer #10:
Space ( “ “ ) is missing in the second sentence, “swing” should be “swing “.

8. On page 345, answer #23:
“line 4” should be “line 12” and “line 5” should be “line 13” in all sentences.


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35269
383
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:1. On page 210, the second example, TraditionalSearch class doesn’t compile:
Text Editor helped me to see that this class doesn’t compile so import java.util.*; is missing. The line starts 1 therefore it should be import or line shouldn’t start 1. If line numbers change that line 9 and line 11 change respectively (in the explanation after example)

Agreed. Logged in the errata.

Mushfiq Mammadov wrote:2. On page 215, example code, import is missing again:
The line starts 3. If line 1 is class name and line 2 is method declaration, import java.util.*; is missing again.

The convention the exam uses is that if the code doesn't begin with line 1, you get to assume everything is right. I've made a note of this on my private list, but I don't consider it an errata. For all we know, the code could be:

Or maybe the author started counting with zero .

Seriously though, it's important because you don't want to get a question wrong because you thought an implied import was missing. The exam almost never tests for missing imports of built in classes. This technique of not having the first few lines is just to save space so they can show more code. Usually when they want to test imports, they make custom packages. We included it in the book because "usually" != "always"

Mushfiq Mammadov wrote:3. On page 216, “Summary” section, the last paragraph:
should be: or

Logged in errata. No "or" though. It should be a -> a.equals(b) because I'm talking about the shorter form in that sentence.

Mushfiq Mammadov wrote:Review questions
4. On page 222, question #11:
Space ( “ “ ) is missing after “climb climb” and “swing swing” in option D and E. “swing swing” should be “swing swing ” but option D is not important.

Agreed and logged. In hindsight, I should have used a dash and not a space.

Mushfiq Mammadov wrote:5. On page 226, question #19:
Option G:
should be:

Agreed and logged

Mushfiq Mammadov wrote:6. On page 229, question #25:
Space ( “ “ ) is missing in all options. Option A (maybe E) is important, “2 4” should be “2 4 ”.

Agreed. I'm consistent! Technically E-G do have a space. It's hard to tell because spaces are invisible . Did I mention, I should have used a different character

Mushfiq Mammadov wrote:Mock explanation
7. On page 344, answer #10:
Space ( “ “ ) is missing in the second sentence, “swing” should be “swing “.

Sigh. I'm really regretting using spaces .

Mushfiq Mammadov wrote:8. On page 345, answer #23:
“line 4” should be “line 12” and “line 5” should be “line 13” in all sentences.

Agreed and logged
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:For all we know, the code could be:

And then you'll not be able to run this very nice Mushfiq class, because this main method is nothing more than an instance method
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35269
383
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah well. Then imagine it says:



 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Yeah well. Then imagine it says:


Much better! And because I'm in a very good mood, I'll imagine the 2 closing curly braces at the end of the code snippet as well
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35269
383
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Jeanne Boyarsky wrote:Yeah well. Then imagine it says:


Much better! And because I'm in a very good mood, I'll imagine the 2 closing curly braces at the end of the code snippet as well

We weren't talking about the end. The point of the numbers is that you are supposed to imagine the code not shown is correct. I was trying to show that there is a possible beginning in two lines that does have the import.

And for anyone reading this who is taking the OCA, to repeat the lesson - assume anything you don't see is correct when line numbers are present that don't begin with 1.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:assume anything you don't see is correct when line numbers are present that don't begin with 1.

++1

And to illustrate it's really a convention on the exam, see this note from the K&B7 study guide.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic