Advertisement
veronikaaa86

01. Read Text

Oct 8th, 2022
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. package whileLoop;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01ReadText {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9. //        while (true) {
  10. //            String input = scanner.nextLine();
  11. //
  12. //            if (input.equals("Stop")) {
  13. //                break;
  14. //            }
  15. //
  16. //            System.out.println(input);
  17. //        }
  18.  
  19.         String input = scanner.nextLine();
  20.         while (!input.equals("Stop")) {
  21.             System.out.println(input);
  22.  
  23.             input = scanner.nextLine();
  24.         }
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement