Home Answers Viewqa Framework WordExtractor.java

 
 


R.S.E.
WordExtractor.java
1 Answer(s)      3 years and 11 months 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(System.in);
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);
}
}
System.out.println(word);
}
}

Thanks









Related Pages:
WordExtractor.java - Framework
WordExtractor.java  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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.