desislava_topuzakova

01. Read Text

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