Menu
Question Index
...

What will be the output of the following program?

class StringBufferTest
{
    public static void main(String[] args)
    {
        String s = "Infinity2K13";
        StringBuffer sb = new StringBuffer(s);
        for (int i = 0; i < s.length(); i++)
        {
            char current = s.charAt(i);
            s.replace(current, Character.toUpperCase(current));
        }
        sb.replace(9, 10, " 20");
        System.out.println(s.split('2')[0] + sb.substring(9));
    }
}


Infinity 2013
INFINITY 2013
INFINITYK13
Infinity2K13
Compilation Error

Doubts

Problems

Topic: Java Character Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App