Question: Given the following in Java: String var1 = new String(abc); String var2 = new String(abc); String var3 = null; String var4 = var2; What is
-
Given the following in Java:
String var1 = new String(abc); String var2 = new String(abc); String var3 = null; String var4 = var2;
What is the outcome for each of the following statement?
var3.equals( abc)
A,Null Pointer Exception
B,Undefined
C, True
D, False
-
Using the same Java code snippet above:
What is the outcome for the following statement?
abc.equals(var3)
A, False
B, True
C, Undefined
D,Null Pointer Exception
-
Using the same Java code snippet above:
What is the outcome for the following statement?
var1 == var2
A, Null Pointer Exception
B, Undefined
C,False
D,True
-
Using the same Java code snippet above:
What is the outcome for the following statement?
var1.equals(var2)
A, True
B, Null Pointer Exception
C, Undefined
D, False
-
Using the same Java code snippet above:
What is the outcome for the following statement?
var2==var4
A, True
B,False
C,Undefined
D,Null Pointer Exception
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
