File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes return statements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "return statements" Watch "return statements" New topic

return statements

Daniel Hyslop

Joined: Dec 08, 2004
Posts: 22
I have a programming problem where I have to construct a class using constuctors and methods .One of the methods contains an array of ints which has to be called from another class using the main method how do I pass a value to another class if the method with the array has to be declared void ? i think this is the case as return statments can only return single values

thankyou for your input in advance
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
You can return a reference to an array or accept an argument that is an array reference and change the elements of the array.

Try this:

or this:

[ February 06, 2005: Message edited by: Mike Gershman ]
[ February 06, 2005: Message edited by: Mike Gershman ]

Mike Gershman
SCJP 1.4, SCWCD in process
I agree. Here's the link:
subject: return statements
It's not a secret anymore!