aspose file tools*
The moose likes Cattle Drive and the fly likes problen with getting method to return array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "problen with getting method to return array" Watch "problen with getting method to return array" New topic
Author

problen with getting method to return array

ione walker
Ranch Hand

Joined: Apr 19, 2001
Posts: 31
I have written a method (getArray) that does some stuff.
(I can't send the code as it is Cattle Drive Stuff)
it generates an array.
I can get it to sent the array to the screen using
System.out.println( intData( i ) );
But I do nto seem to be able to get the
array outside the method.
I am sure that I am doing something wrong in trying to
get my genArray() to return my array
that is a matter of not understaning the syntax
well enough.
HELP I feel like I am on the verge of making
a breakthrough if only I could tie my shoes.
;->
=========
public class CattleDrive
{
public static void main( String[] args )
{
String myString = //I get a string from somewhere
myArray[] = genArray( myString );//get the intarray of a string.
}
static int genArray( String s )
{
Magic Java stuff
System.out.println( myArray[ i ] );// this works
}
return myArray[];
}

------------------
=======================
Ione Walker
walkeri@usa.net
========================

------------------
=======================
Ione Walker
walkeri@usa.net
========================


=======================<BR>Ione Walker<BR>walkeri@usa.net<BR>========================
Richard Boren
Ranch Hand

Joined: Mar 01, 2001
Posts: 233
Ione, in your genArray() you are only returning an int not an array of int's.
You have --> static int genArray( String s )
You should have --> static int[] genArray( String s )

Hope this helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problen with getting method to return array
 
Similar Threads
Strange thing when I try to run program
Returning an arrray from a method?
I did not want delete this one.
Back for another great season on the Drive
Assignment Log