Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ARRAY

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
how can I return a array to my main?

eg.

private String []array;

public String ArrayReturn()
{
return ... // what do I have to put here to return the array to my main?
}
 
If I see your problem, you want to return the array attribute in ArrayReturn method?
If so, you should write :

public String[] ArrayReturn()
{
...
return array;
}

 
here is the code how to send the array

public class Help {

public static void main(java.lang.String[] args) {
String [] ss = send();
System.out.println(ss[0]+ss[1]+ss[2]);

}

public static String[] send(){
String [] arr= new String[3];

arr[0]="man";
arr[1]="two";
arr[2]= "three";

return arr;

}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top