Question: Return array from a different method as printed output text. Can someone please show me how to return all of the numbers in an array

Return array from a different method as printed output text. Can someone please show me how to return all of the numbers in an array as text when the array is in a different method? This is what I have so far:

package Labs1

import java.util.*;

public class Module1Labs {

public int[] M(int n) {

int[] myArray = new int[n];

for (int i = 0; i < myArray.length; i++) {

myArray[i] = i;

}

return myArray;

}

public static void main(String[] args){

int[] myArray2 =

System.out.println(myArray);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!