Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Framework WordExtractor.java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


R.S.E.
WordExtractor.java
1 Answer(s)      5 years and 4 months ago
Posted in : Framework



Advertisement
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 Tutorials/Questions & Answers:
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
Advertisements
 

 

 

DMCA.com