The Artima Developer Community
Sponsored Link

Java Buzz Forum
Java program to count number of words in a string

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Arpit Mandliya

Posts: 190
Nickname: mandliya23
Registered: May, 2017

Arpit Mandliya is Java programmer working on Core java, Spring, Hibernate
Java program to count number of words in a string Posted: Oct 26, 2017 12:29 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Arpit Mandliya.
Original Post: Java program to count number of words in a string
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
Latest Java Buzz Posts
Latest Java Buzz Posts by Arpit Mandliya
Latest Posts From Java tutorial for beginners

Advertisement

In this post, we will see Java program to find number of words in a String. Problem Find the number of words in a String. For example: There are 6 words in below String welcome to java tutorial on Java2blog Algorithm The algorithm will be very simple. Initialize count with 1 as if there are no spaces in the string, then there will be one word in the String. Check if you encounter any space. Once you find the space, check it next character. If it is not space then we found a word in the String.Increment the count variable.

The post Java program to count number of words in a string appeared first on Java2Blog.

Read: Java program to count number of words in a string

Topic: How to access the methods of a class using Java Reflection | Reflection in java Previous Topic   Next Topic Topic: Spring and Threads: Transactions

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use