Menu
Question Index
...

Write a program to find how many times the given word occurs in given sentence.

Input (String, String) Output (int)
property searches and information on real estate classes
searchword = real
1
Being in your arms makes me feel as though I am truly in heaven showered in an endless rain of happiness for eternity, so just be with me forever.
searchword = me
2
Java's primary motivation was platform independence and not internet. Platform independence means the ability to write a program on one platform and run it on any other platform without worrying about the platform specific features. If it works on one platform it should work on all other platforms.
searchWord = it
3
Learn Java with Merit Campus
searchWord = Campus
1



class FindWordOccurrenceCount
{
    public static void main(String s[])
    {
        String sentence = "Good is good so long as it is good";
        System.out.println("The word 'good' occurs " + getWordOccurenceCount(sentence, "good") + " times.");

    }


    public static int getWordOccurenceCount(String sentence, String searchWord) {
    }

}

Doubts

Problems

Topic: Additional String 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