Word occurrences counter - Java example

preview_player
Показать описание
The program counts the number of occurrences of a word in a given string. It trims the string to remove the leading and trailing spaces. Then it counts the target word at the beginning and at the end, if any. Then it counts the target words surrounded by spaces.

You'll learn most by trying my code while watching the video.

Please post your improvement on my code on the comments.

Concepts:
Scanner class
For loop
String operation

Playlist of my Java course

Playlist of my Java examples
Рекомендации по теме