1. What is true given the following code:
char[] array1 = {'j', 'a', 'v', 'a'};
char[] array2 = array1;
array2[2] = 'b';
2. What is displayed when the following program is executed?
public class CanYouDoIt {
public static void main (String[] args) {
int way[] = {1, 2, 3, 4};
callIt(way);
System.out.println(way[1] + way[2]);
}
public static void callIt(int myWay[]) {
myWay[1] = myWay[3];
}
}
Answers: 1-d, 2-d
Return to the CCSF Computer Science Department Home Page