Question: 1.Write code for a Java method, printArray , that takes an int array as parameter and prints it out, one element per line. public static

1.Write code for a Java method, printArray, that takes an int array as parameter and prints it out, one element per line.

public static void printArray (int[] values){

Methods that do NOT return a result have void as return

type. Notice how an array parameter type is passed, int []

}// end printArray

2.Write code for a Java method that takes in as input parameter an integer number, say num, and returns a double array of size num with all entries in the array initialized to 3.0.

public static double[] arrayDouble (int num) {

Note the return type of this method: it is double[]

indicating that an array of type double is to be returned

What is the printArray? Can you explain this question? Thank you!

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!