aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes hashcode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "hashcode" Watch "hashcode" New topic
Author

hashcode

Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

tell me wether the



is the valid override of


and also please explain why



thanks in advance

SCJP6.0,My blog Ranchers from Delhi
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18997
    
  40


First, I am assuming you are referring to the hashCode() method... you may be referring to a method of your own and not the Object's hashCode() method, but I'm guessing not.


Yes. It's a valid override. You can have the subclass version be synchronized, while the superclass version is not. The subclass version will be executed.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

please tell whether this applies to every overriding case...........
like




whether all these are valid override.........also whether it breaks any OOPs principles.......or everything is fine..........with it....
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

phil sohar wrote:please tell whether this applies to every overriding case...........
like




whether all these are valid override.........also whether it breaks any OOPs principles.......or everything is fine..........with it....


Don't you try it?


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Yes it is valid for every case


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Arjun Srivastava
Ranch Hand

Joined: Jun 23, 2010
Posts: 432

ok.


SCJP 6 | FB : Java Certifications-Help. | India Against Corruption
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

Deepak Bala wrote:Yes it is valid for every case


thanks for clearing my doubt
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: hashcode