Home / Questions / What is the output of the following code fragment if "abc" is passed as argument to the func( ) ?
Explanatory Question

What is the output of the following code fragment if "abc" is passed as argument to the func( ) ?

👁 22 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation


public static void func(String s1)
{
    String s = s1 + "xyz";
    System.out.println("s1 = " + s1);
    System.out.println("s = " + s);
}

Output:


s1 = abc
s = abcxyz