what is the best way to access the array from different classes?
do i replace foo with the class that im in?
do i replace arr with the array i want to get?
thanks
do i replace foo with the class that im in?
do i replace arr with the array i want to get?
thanks
Code:
////////////////////////
class Foo{
private int arr[];
public int[] getArr(){
return this.arr;
}
}
//from other class now
new Foo().getArr();or else it needs to be static
///////////////////////////////////////////////
class Foo{
public static int arr[];
}
//from other class
int arr[] = Foo.arr;