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

0

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

MyClass newClassObj = new MyClass();
int[] secondArray = newClassObj.getNumArray();
Posted by: Guest on March-22-2020
0

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();
    }
 }
Posted by: Guest on March-22-2020

Code answers related to "how to access contents of an array from another class in java"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language