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

Home Answers Viewqa Framework

View Questions and Answers by Category


Have Programming Question? Ask it here!

1 Answer(s)      5 years and 8 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(;
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