Sign in to follow this  
gamechampionx

Urgent Help Needed

Recommended Posts

I need urgent help with a probably simple cast exception in Java. I have a class called Pile and LayoutPile extends is. I have an object declared such that Pile x = new LayoutPile(), then it it modified and so on using basic pile things. Later, I try to cast it to a LayoutPile, using something like (LayoutPile)x.somefunctiononlyinLayoutPile(), and it runs but crashes because of some unexplained cast exception. What's the deal with this? I see no problem with my code. Please help.

Share this post


Link to post
Share on other sites
I have try that, and it still crashes. It is clearly compatible with the type since it's made a new LayoutPile when initialized but then I cast it and it just crashes. Could my compiler be making a mistake cause nobody I talk to can figure out why this is happening.

Share this post


Link to post
Share on other sites
I was going to say what Oluseyi said, but seeing as you tried that, I would like to see the code within the function. Perhaps you can print some debug info, to see if the virtual machine actually makes the jump into the function, or breaks before it runs. My guess is something is happening in the function.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this