Menu
Question Index
...

Write a program to check the given input string is starts with given prefix or not.

Input (String, String) Output (Boolean)
'meritCampus', 'merit' true
'Vijayawada', 'Vijay' true
'Java School', 'java' false
'MeritCampus', Campus false



class IsStartsWithGivenPrefix
{
    public static void main(String s[])
    {
        String inputString = "meritCampus";
        String prefix = "merit";
        System.out.println("The input string is starts with " + prefix + ": " + isStartsWith(inputString, prefix));

    }


    public static boolean isStartsWith(String inputString, String prefix) {
    }

}

Doubts

Problems

Topic: Java String startsWith() And endsWith() Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App