Java Collection Program Test-3

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

int a1[] = {2, 4, 6};

int a2[] = {2, 4, 6};

System.out.println(a1 == a2);

}

}

What will be the output of the following java code?

import java.util.Arrays;

public class Test {

public static void main(String[] args) {

int a1[] = {2, 4, 6};

int a2[] = {2, 4, 6};

System.out.println(Arrays.equals(a1, a2));

}

}

What will be the output of the following java code?

import java.util.Arrays;

public class Test {

public static void main(String[] args) {

int a1[] = { 2, 4, 6 };

int a2[] = Arrays.copyOf(a1, 5);

a2[3] = 10;

a2[4] = 40;

System.out.println(Arrays.toString(a2));

}

}

What will be the output of the following java code?

import java.util.ArrayList;

import java.util.Arrays;

import java.util.List;

public class Test {

public static void main(String[] args) {

List list = new ArrayList();

list.add("Java");

list.add("spring");

list.add("jsp");

String str[] = list.toArray(new String[list.size()]);

System.out.println(Arrays.toString(str));

}

}

What will be the output of the following java code?

import java.util.Arrays;

public class Test {

public static void main(String[] args) {

int[] intArray = { 1, 6, 3, 9,4,10 };

int[] value = Arrays.stream(intArray).filter(num -> num > 5).toArray();

System.out.println(Arrays.toString(value));

}

}