nerdexam
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)
  • A
    83% (20)
  • B
    4% (1)
  • C
    8% (2)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full GSSP-JAVA Practice