1 Answer(s)      7 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(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);


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