Menu
Question Index
...

What will be the output of the following program?

public class Example {
    public static void main(String[] args) {
        StringBuffer sb = new StringBuffer("How to reverse string");
        String str = sb.reverse().toString();
        System.out.print(str);
    }
}


gnirts esrever ot woH
woH ot esrever gnirts
gnirts reverse to woH
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java StringBuffer, reverse() - Reverse A String 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