Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training



Share on Google+Share on Google+

1 Answer(s)      8 years ago
Posted in : Framework
View Answers

June 29, 2009 at 12:03 PM

Hi Friend,

Try the following code:

import java.util.Scanner;

public class WordExtractor {
public static void main(String[] args) {

System.out.println("Enter a sentence to form a new word: ");
Scanner input=new Scanner(;
String st=input.nextLine();
String word=st.substring(0, 1);
for(int i=0;i<st.length();i++){
if(st.charAt(i)==' '){
word=word+st.substring(i+1, i+2);



Related Tutorials/Questions & Answers: - Framework  I am looking to put together a program that identifies a letter from a sentence to form a word. Can you get me started in the right direction on how to do this?  Hi Friend, Try the following code