Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

return statements

 
Daniel Hyslop
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic