desislava_topuzakova

1. Четене на думи

Dec 5th, 2021
652
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package WhileLoop;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ReadWords_01 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         //1. повтаряме: отпечатваме въведената дума
  9.         //2. спираме: думата == "Stop"
  10.         //3. продължавам: думата != "Stop"
  11.  
  12.         String word = scanner.nextLine();
  13.         while (!word.equals("Stop")) {
  14.             System.out.println(word);
  15.             word = scanner.nextLine();
  16.         }
  17.     }
  18. }
  19.  
RAW Paste Data