Menu
Question Index
...

What will be the output of the following program?

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


2013
2K13
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Conclusion Of Strings In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App