I am trying to print an int[] array from a seperate method in the same class.
public class LargeInteger {
public LargeInteger(String s) {
int[] intArray = new int[s.length()];
for (int i = 0; i < s.length(); i++) {
intArray[i] = Character.digit(s.charAt(i), 10);
}
}
public Object display() {
for (int i = 0; i < intArray.length; i++) {
System.out.print(intArray[i]);
}
}
}
My intArray is clearly being hidden from the display method, but I am not sure what to do
I will give you the answer but you should first invest some time to look up your problem on google. Google knows “almost” everything…
And your display method should be void if it isn’t returning anything..