aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes chapter 2 Object orienation  polymorphism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "chapter 2 Object orienation  polymorphism" Watch "chapter 2 Object orienation  polymorphism" New topic
Author

chapter 2 Object orienation polymorphism

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634



SCJP1.6 JAVA 6 CERTIFICATION Guide-310-065
by Katherine Sierra (Author), Bert Bates (Author)


chapter 2bject orienation
pg-102



even though the compiler
only knows about the declared reference type, the Java Virtual Machine (JVM)
at runtime knows what the object really is. And that means that even if the
PlayerPiece object's displayShape() method is called using a GameShape
reference variable, if the PlayerPiece overrides the displayShape() method, the
JVM will invoke the PlayerPiece version! The JVM looks at the real object at the
other end of the reference, "sees" that it has overridden the method of the declared
reference variable type, and invokes the method of the object's actual class


can anyone illustrate with an example


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 438

well you will get all this in the next part of the book in the Overriding and overloading section
this is the example I have tried in the book hope this helps


Happy preparation

SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: chapter 2 Object orienation polymorphism
 
Similar Threads
HELP NEEDED FOR CALLING METHOD OF THE SAME CLASS
Polymorphic method invocations
Basic Java Question
i dont understand this polymorphisim