Q. What will be the output of the following Java code?

Code:
class output 
{
    public static void main(String args[])
    { 
       StringBuffer s1 = new StringBuffer("Hello");
       s1.setCharAt(1,'x');
       System.out.println(s1);
    }
}
  • (A) xello
  • (B) xxxxx
  • (C) Hxllo
  • (D) Hexlo
πŸ’¬ Discuss
βœ… Correct Answer: (C) Hxllo

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
84
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Neelam Mittal
Publisher
πŸ“ˆ
86%
Success Rate