my dog learned polymorphism
The moose likes Beginning Java and the fly likes Casting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Casting" Watch "Casting" New topic


akila sekaran
Ranch Hand

Joined: Jun 12, 2012
Posts: 48

what will happen in this ?
Panagiotis Kalogeropoulos

Joined: May 27, 2011
Posts: 99

Have you tried it yourself? What do you think will happen and why?
akila sekaran
Ranch Hand

Joined: Jun 12, 2012
Posts: 48
Class cast exception ;-)
Anayonkar Shivalkar

Joined: Dec 08, 2010
Posts: 1541

akila sekaran wrote:Class cast exception ;-)

So, what are you casting into what? Please take a close look at your code (by the way, it also contains a compilation error, which I believe might be a typo during pasting the code).

Hint : All Managers are Employees - but can you cast an Employee to Manager?

Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Have you checked out Aspose?
subject: Casting
It's not a secret anymore!