• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

The definition of value-based classes

 
Ranch Hand
Posts: 49
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could someine explain this extract in one's own words, please.


A program may produce unpredictable results if it attempts to distinguish two references to equal values of a value-based class, whether directly via reference equality or indirectly via an appeal to synchronization, identity hashing, serialization, or any other identity-sensitive mechanism. Use of such identity-sensitive operations on instances of value-based classes may have unpredictable effects and should be avoided.



This extract comes from here.
 
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

Kamil Hlubek wrote:Could someine explain this extract in one's own words, please.


To be honest this seems waaaaaaaaay to complicated for the OCA exam. Is this something which was mentioned in one of the OCA8 study guides? Or did you just encounter it while browsing the internet?
 
Kamil Hlubek
Ranch Hand
Posts: 49
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, if I make a tour on the API I come always at complicated stuff out. After about 1 hour or two I notice then : "What? It felt like about half an hour" .

So the answer is: No I simply looked at the LocalDate class from the Java Date-Time API and there is written of course, that it is a value-based class.

Apparently your meaning, that I ask you, what are all the identy-sensitive operations, but my intend is to ask you to explain me the intention of the test only with the reference equality( == ), because the others are all marked as or, so they should not differ in the general working of the value-based classes in my opinion.
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The quote seems to be a convoluted way of comparing the equality operator versus the equals() method ... and basically say "use the equals() method for cases where the equality operator will not work"...

Henry
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic