I was wondering how you get java to print all the outputs achieved during the process of the loop. I am working on a class assignment in which the user inputs multiple, single words using scanner and loop.
CODE
import java.util.Scanner;
public class InputFilter
{
public static void main(String[]args)
{
Scanner kb = new Scanner(System.in);
System.out.println("Enter words and type 'stop' 'done' or 'end' when finished:");
String word = kb.next();
while (!word.contains("stop") && !word.contains("end") && !word.contains("done"))
{
The program is supposed to stop and display the words in a sentence, taking out the words "a", "an", and "the". So an entry like..
This
dog
is
a
fast
one
-would be "This dog is fast one"
but I don't know how to string all the entries together, some help?