Menu
Question Index
...

What will be the output of the following program?

public class TrySplit {
    public static void main(String str[]) {
        String s = "usingsplitfunction";
        String[] ex = s.split("i");
        for (int i = 0; i < ex.length; i++)
            System.out.println(ex[i]);
        String s1 = "a1b2c3d4ef";
        String[] ex1 = s1.split("\\d", 3);
        for (String s2 : ex1)
            System.out.print(s2);
        String s2 = "Learn 4rm MeritCampus";
        String[] c = s2.split("\\d");
        System.out.println("\n" + c.length);
        display("ramuknarikitelo");
    }
    public static void display(String... names) {
        for (String mynames : names)
            System.out.print(new StringBuffer(mynames).reverse().toString() + " ");
    }
}


us
ingspl
itfunct
ion
3d4
4
ramuknarikitelo
usi
ngspli
tfuncti
on
abcdef
15
oletikirankumar
us
ngspl
tfunct
on
abc3d4ef
2
oletikirankumar
us
a1b2c3d4ef
15
ramuknarikitelo
Some other output
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