GIAC
GSSP-JAVA · Question #21
What will be the output of the following program? class Stringtest { public static void main(String args[]) { String s= "test"; s.concat("paper"); System.out.println(s); } }
The correct answer is A. It will display test. See the full explanation below for the reasoning.
Question
What will be the output of the following program? class Stringtest { public static void main(String args[]) { String s= "test"; s.concat("paper"); System.out.println(s); } }
Options
- AIt will display test.
- BIt will display testpaper.
- CIt will generate a compile-time error.
- DIt will display paper.
How the community answered
(24 responses)- A83% (20)
- B4% (1)
- C8% (2)
- D4% (1)
Community Discussion
No community discussion yet for this question.