Question: Problem #12: A. What is wrong with the following method definition? public static void doubleSize(int[ ] a) { a = new int[a.length * 2]; }

Problem #12:

A. What is wrong with the following method definition?

public static void doubleSize(int[ ] a) {

a = new int[a.length * 2];

} // end of doubleSize

Problem #8

What outputs will be produced by the following codes?

A.

double tide[ ] = {12.2, -7.3, 14.2, 11.3};

System.out.println("Tide 1 is " + tide[1]);

System.out.println("Tide 2 is " + tide[2]);

B.

int i;

int[ ] a = new int[10];

for (i=0; i< a.length; i++)

a[i]=2*i;

for (i=0; i System.out.print(a[i] + " ");

System.out.println();

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!