Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to write a method that can return either int OR a double

807589Sep 2 2008 — edited Sep 3 2008
I need to write a method that returns an int or a double, but I don't know the return type until the method does some calculations. I know there's a way to do this using the object class. Does anyone have a good small example of what I'm trying to do?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2008
Added on Sep 2 2008
12 comments
921 views