• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Sybex CSG 17 (Q3 Assessment Test)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure the exact page because i purchased through the Play Store.  It says page 54-57/1351.


Given how pedantic this test is, I don't think the following answer E for Question 3 is sufficient to be true in all cases.

Points to note:
1. This is a lambda with an expression without a body block. data.add(s) vs  {data.add(s);}
These are not legal:

2. Assuming we do convert this lambda to one with a body we could add a sync block as follows:

2. This scenario can still fail if you don't use the same mutex reference object. Example as follows:


3. Another option would be to leverage the Collections.synchronizedCollection API.
 
author & internet detective
Posts: 42003
911
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
I think the spirit of that question is given a proper synchronized block that meets the requirement. I'll make a note to revisit though.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic