Menu
Question Index
...

What will be the output of the following program?

public class Firstlast {
    public static void main(String args[]) {
        StringBuffer sub = new StringBuffer("I have two sisters,two brothers and two uncles");
        int k;
        k = sub.indexOf("two");
        System.out.print(k + ",");
        k = sub.lastIndexOf("two");
        System.out.print(k);
    }
}


9,30
8,38
7,36
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Additional StringBuffer Methods 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