• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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: 42173
937
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 suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic