how to get a number from another class and store it in an array code example
Example 1: how to access contents of an array from another class in java
class MyClass
{
//Variable I want to return
private int[] numArray = {1, 2, 3};
public int[] getNumArray() {
return numArray.clone();
}
}
Example 2: how to access contents of an array from another class in java
MyClass newClassObj = new MyClass();
int[] secondArray = newClassObj.getNumArray();