GIAC
GSSP-JAVA · Question #139
You work as a Software Developer for UcNet Inc. You write the following code using Java. class StringTest { public static void main(String args[]) { String s = "Hi"; concat("There")…
The correct answer is B. It will compile and execute successfully and will display Hi as the output. See the full explanation below for the reasoning.
Question
You work as a Software Developer for UcNet Inc. You write the following code using Java. class StringTest { public static void main(String args[]) { String s = "Hi"; concat("There"); System.out.println(s); } } What will happen when you try to compile and execute the code?
Options
- AIt will not compile.
- BIt will compile and execute successfully and will display Hi as the output.
- CIt will compile but will throw an exception at runtime.
- DIt will compile and execute successfully and will display HiThere as the output.
How the community answered
(44 responses)- A5% (2)
- B75% (33)
- C14% (6)
- D7% (3)
Community Discussion
No community discussion yet for this question.