desislava_topuzakova

01. Read Text

Feb 5th, 2022
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ReadText_01 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         //повтарям: прочитам текст + отпечатвам
  7.         //спираме: текст е "Stop"
  8.         //продължавам: текст не е "Stop"
  9.         String text = scanner.nextLine();
  10.  
  11.         while (!text.equals("Stop")) {
  12.             System.out.println(text);
  13.             text = scanner.nextLine();
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment