• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Potential Error - Table 4.5, Page 204, Section: Printing a Stream  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The table states that the third option - ending with .count() - is not destructive. But count() is a terminal operation returning a long not a stream. I think .count() was added by mistake.

E.g.,



See:

PrintStream.java:9: error: illegal start of expression
                        .forEach(System.out::print);
                        ^
1 error

Comment out the .count() and things are fine.
(Apologize if this was reported before or if I missed the point and am blind to it - did not see it here https://www.selikoff.net/java-ocp-8-programmer-ii-study-guide/  or searching the forum for 204.)

Thanks!
 
Jacob Lambert
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry - not sure how to edit - I posted with the semi-colon after count. Should be without - and the error should be:
PrintStream.java:9: error: long cannot be dereferenced
                        .forEach(System.out::print);
                        ^
1 error
 
Jacob Lambert
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to the Similar Threads suggestion, I see this was posted.
I apologize. It may be deleted.
https://coderanch.com/t/661375/certification/Errata-OCP-Oracle-Certified-Professional
 
Jacob Lambert
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to the Similar Threads suggestion, I see this was posted.
I apologize. It may be deleted.
https://coderanch.com/t/661375/certification/Errata-OCP-Oracle-Certified-Professional
 
Marshal
Posts: 62819
203
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We don't routinely delete discussions; as you have seen yourself, the old discussion was useful to you, and you have provided a useful reminder.
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!