The moose likes Beginning Java and the fly likes I need help understanding some basic function calls. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I need help understanding some basic function calls." Watch "I need help understanding some basic function calls." New topic

I need help understanding some basic function calls.

David Miser

Joined: Jul 22, 2013
Posts: 9
Sorry about the unspecific title, I'm having trouble wording what my issue is because I don't really understand what I'm having trouble with.

I'm currently running through the courses at and everything is going well. Unfortunately I've run into a problem I can't get past.

It's asking me to pass an int (lets call it currentKeys) from main() to add_keychains(). That function call will execute a few line prints and ask how many Keychains I would like to add to the total and take the user input. Somehow I have to take that and add it to the currentKeys variable that is stored in the main function (I have no idea how to do that), and then return the new total.

I'm not sure if I am simply misinterpreting what he's saying or not. I don't want to use some unintended method of doing so or use a way he hasn't taught me yet. So far I feel I genuinely understand everything he has taught so far. I understand why I have to use these things and how/when to. So I don't wanna "cheat" my way through this one, I just need help understanding it.

I'm sorry if I wasn't very clear, just ask if you need clarification on anything.
K. Tsang

Joined: Sep 13, 2007
Posts: 3132

If you read the instructions the main idea is in the add_keychain(), remove_keychain() methods. Passing an int and returning an int should give you access to the new number of keychains.

It looks like the returned number of keychains is for the view_order() and checkout() methods.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
I agree. Here's the link:
subject: I need help understanding some basic function calls.
It's not a secret anymore!