Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import static java.lang.System.*;
- import java.util.Scanner;
- import java.lang.Math;
- import java.util.*;
- class Main{
- public static void main (String str[]) throws IOException {
- ArrayList <String> a = new ArrayList<String>();
- Scanner scan = new Scanner(System.in);
- int flag = 0;
- String temp = "error";
- System.out.println("Please enter words, enter STOP to stop the loop.");
- while (flag == 0)
- {
- temp = scan.nextLine();
- if (temp.equals("STOP"))
- {
- flag = 1;
- break;
- }
- a.add(temp);
- }
- for (String b : a)
- {
- if(b.indexOf('a') != -1)
- System.out.println(b);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment