Create a panel with borderlayout add a button labeled ok to


(a) Show the printout of the following code:

public class Test {
public static void main(String[] args) {
int[] a = {1, 2};
swap(a[0], a[1]);
System.out.println("a[0] = " + a[0] + " a[1] = " + a[1]); }

public static void swap(int n1, int n2) {
int temp = n1;
n1 = n2;
n2 = temp;
}
}

(b) Create a panel with BorderLayout. Add a button labeled "OK" to the south side of the panel.

(c) Given the following program, show the values of the array in the following figure:

public class Test {
public static void main(String[] args) {
int[] values = new int[5];
for (int i = 1; i < 5; i++) {
values[i] = i;
}

values[0] = values[1] + values[4];
}
}

(d) Suppose A is an abstract class, what is wrong in the following code?

A[] list = new A[10];
list[0] = new A();

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create a panel with borderlayout add a button labeled ok to
Reference No:- TGS0762514

Expected delivery within 24 Hours