how to access contents of an array from another class in java

Solutions on MaxInterview for how to access contents of an array from another class in java by the best coders in the world

showing results for - "how to access contents of an array from another class in java"
Mira
19 Oct 2017
1class MyClass
2{
3    //Variable I want to return
4    private int[] numArray = {1, 2, 3};
5
6    public int[] getNumArray() {
7        return numArray.clone();
8    }
9 }
Francesco
10 May 2018
1MyClass newClassObj = new MyClass();
2int[] secondArray = newClassObj.getNumArray();
queries leading to this page
initialize array from another class classjava creating arrays in a different class an dusing it in another classaccess array from another class javahow to take an array from another class and fill it in javajava public array in another classhow to take an array from another class access arrays from another class javajava access array from another classhow to make an array class of another class javause integer array in another class androidhow to get a number from another class and store it in an arrayhow to access contents of an array from another class in javahow to access an array from another class in javahow to get an array from another class javahow to access array of objects from another class javajava getting an array element from another classhow to use an array in another class javaget item from array in different classjava cannot read array from separate classstoring values in array from another class javause array from another class javahow to give access to an array from another class in javac 23 call an array asnwer to another classjava class array from other classhow to pass variable from one class to another in react jshow to make an array of another class javaimport an array form another class javaaccess public array in another class javahow to access array from another class javagroovy get access to array in other classhow to make an array of other class javajava access another class arrayhow to access contents of an array from another class in java