veronikaaa86

01. Read Text

Apr 1st, 2023
847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 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.         String text = scanner.nextLine();
  10.         while (!text.equals("Stop")) {
  11.             System.out.println(text);
  12.  
  13.             text = scanner.nextLine();
  14.         }
  15.        
  16. //        while (true) {
  17. //            String text = scanner.nextLine();
  18. //            
  19. //            if (text.equals("Stop")) {
  20. //                break;
  21. //            }
  22. //
  23. //            System.out.println(text);
  24. //        }
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment