• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

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

 
Ranch Hand
Posts: 221
27
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 115, the example of insert method

The line 6 // sb = -ani-mals should be // sb = -ani-mals-
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 221
27
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
    178
    Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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!
     
    author & internet detective
    Posts: 41763
    887
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Agreed. Thank you.
     
    Remember to always leap before you look. But always take the time to smell the tiny ads:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic