Menu
Question Index
...

What will be the output of the following program?

public class Delete {
    public static void main(String args[]) {
        StringBuffer sb = new StringBuffer("Highest Common Factor");
        sb.delete(10, 12);
        System.out.println("After delete: " + sb);
        sb.deleteCharAt(13);
        System.out.print("After delete char: " + sb);
    }
}


After delete: Highest Coon Factor
After delete char: Highest Comon actor
After delete: Highest Coon Factor
After delete char: Highest Coon actor
After delete: Highest Coon Factor
After delete char: Highest Common actor
After delete: Highest Common Factor
After delete char: Highest Coon actor
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java delete() and deleteCharAt() Methods In StringBuffer

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App