Give the output of the following program

Short Answer
Views 16

Answer:


class MainString
{
    public static void main(String args[])
    {
        StringBuffer s = new StringBuffer("String");

        if (s.length() > 5 && s.append("Buffer").toString().equals("X"))
        {
            // empty statement
        }

        System.out.println(s);
    }
}

Output:


StringBuffer

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.