Question: 1. Which method call will result in C printing out? public static void uhOh(String value) { try { int num = 5 / value.length(); System.out.print(A);
1.
Which method call will result in "C" printing out?
public static void uhOh(String value) { try { int num = 5 / value.length(); System.out.print("A"); } catch (ArithmeticException e) { System.out.print("B"); } catch (NullPointerException e) { System.out.print("C"); } } Group of answer choices
uhOh("rouge");
uhOh("");
uhOh(null);
uhOh("null");
2.
What will print out?
int[] alpha = {2, 4, 6, 8}; int[] beta = {2, 4, 6, 8}; int[] gamma = beta; System.out.print(alpha == beta); System.out.print(alpha == gamma); Group of answer choices
truetrue
truefalse
falsefalse
falsetrue
3.
What will the following code print out when it is run?
int[] a = {1, 2, 3}; int[] b = {4, 5, 6}; int[] c = {7, 8, 9}; int[][] d = {a, b, c}; a = c; b[2] = 0; System.out.print(d[2][2]); Group of answer choices
0
6
9
3
q4.
What does the following code print out?
ArrayListchars = new ArrayList<>(); chars.add('A'); chars.add('B'); chars.set(0,'C'); chars.add(1,'D'); chars.add(0,'E'); chars.remove(0); for ( char ch : chars) { System.out.print( ch + ", "); }
Group of answer choices
C, D, B,
E, C, B,
E, D, B,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
