aspose file tools*
The moose likes Beginning Java and the fly likes help with methods return types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help with methods return types" Watch "help with methods return types" New topic
Author

help with methods return types

Eric Johns
Greenhorn

Joined: Sep 13, 2003
Posts: 20
I have car class
and a method in that methods I need to return those values,in program that will be calling on that method and it's findingmatchingcar class with it's with 80% or greater of the users required inputs my question is I'm having program with the return types and how would I return those values and have them get printed? thanks Eric
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
in that methods I need to return those values,in program that will be calling on that method and it's findingmatchingcar class with it's with 80% or greater of the users required inputs my question is I'm having program with the return types and how would I return those values and have them get printed?
I am eager to help, but what is the question, again?
Eric Johns
Greenhorn

Joined: Sep 13, 2003
Posts: 20
My basic question is I have to return make,model,type,price,safetyrating,mpg if that car is with in my users preference but how do you return values with different types, their are strings,int,doubles.
chris czinder
Greenhorn

Joined: Oct 02, 2002
Posts: 28
If you are using different types you could always use the wrapper classes and change them about as you feel fit.
for example

this would turn the String "1234" into the int 1234.
the second part would turn the double 25.50 into the String "25.50"
hope this helps.

[ October 19, 2003: Message edited by: chris czinder ]
[ October 19, 2003: Message edited by: chris czinder ]
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
My basic question is I have to return make,model,type,price,safetyrating,mpg if that car is with in my users preference but how do you return values with different types, their are strings,int,doubles.
You can always return an object that contains all the needed info.
Ray Muntz
Greenhorn

Joined: Oct 19, 2003
Posts: 3
since 'findfit' is a bool, make the method type bool but put the
after the

so it would look something like

is this what your trying to do?
then you wouldnt be assigning findFit to anything, you would be using it in an if statement, like
or if all your trying to do is Print the details if it fits, make it like this

Then all you would be doing is displaying the information if it was the right car or else display that its not a match. hope this helps.
[ October 19, 2003: Message edited by: Ray Muntz ]

Fate favors Only those Brave enough to try.
Eric Johns
Greenhorn

Joined: Sep 13, 2003
Posts: 20
Yeah, that works thanks alot guys
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help with methods return types