aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Guess The result 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 "Guess The result" Watch "Guess The result" New topic
Author

Guess The result

dilan alex
Greenhorn

Joined: Sep 17, 2011
Posts: 27
Hi All,



Regards,
Dil.
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

So what should we guess? Outputs?
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
HowToAskQuestionsOnJavaRanch
dilan alex
Greenhorn

Joined: Sep 17, 2011
Posts: 27
Hi All,

Actually I just wanted to ask about this code snippet.



Here Prius Class extends Toyota class and as we know static methods are not overridden. But in main method I have created Prius object and calling breaking method -
Its called Toyota class breaking method. how does this happen ??
Static methods are not overridden ? is it?

this is the output i get

Vehecle Created....
Toyota Created....
Prius Created....
Toyota Breaking....

Any help??

Thanks,
Dil.

Peter Heide
Ranch Hand

Joined: Nov 04, 2006
Posts: 31
Add this to the main method:



The output ist:

Vehecle Breaking....


The reference is of type Vehicle and the object is of type Prius. It takes the Vehicle.breaking() and not the Toyota.breaking() because both methods are static methods and they are not overridden.


SCJA
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Guess The result