Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dash is missing on page 115 (Java OCA 8 Programmer I Study Guide)

 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 115, the example of insert method

The line 6 // sb = -ani-mals should be // sb = -ani-mals-
 
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
Mushfiq Mammadov wrote:The line 6 // sb = -ani-mals should be // sb = -ani-mals-

That's true!

And would the output be the same if you swapped lines 4 and 6?
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote: And would the output be the same if you swapped lines 4 and 6?

If we add and remove characters, their indexes change. So the output would not be the same. If we swapped lines 4 and 6 the output will be:
  • line 4 --> anim-als
  • line 5 --> -anim-als
  • line 6 --> -anim-a-ls
  •  
    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
    Mushfiq Mammadov wrote:If we add and remove characters, their indexes change. So the output would not be the same.

    True indeed!

    Mushfiq Mammadov wrote:If we swapped lines 4 and 6 the output will be:
  • line 4 --> anim-als
  • line 5 --> -anim-als
  • line 6 --> -anim-a-ls

  • Spot-on!
     
    Jeanne Boyarsky
    author & internet detective
    Marshal
    Posts: 35279
    384
    Eclipse IDE Java VI Editor
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic