What will the following program print when run?.
public class Main { private static void putO(String s1) { s1 = s1.trim();/*from w w w. j a va 2 s .c o m*/ s1 += "O"; } public static void main(String[] args) { String s1 = " W "; putO(s1); s1.concat("W"); System.out.println("|" + s1 + "|"); } }
Select the one correct answer.
(d)
The call to the putO()
method does not change the String object referred to by the s1 reference in the main()
method.
The reference value returned by the call to the concat()
method is ignored.