While | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

While

How to exit the while loop. By writing the word "exit" by the user? String str = new String(); Scanner scanner = new Scanner(System.in); while (str.length() == 0) { System.out.print(“Please enter something”); str = scanner.nextLine(); }

30th Jan 2022, 3:13 PM
Игорь Панасик
1 Answer
0
Thanks!
30th Jan 2022, 3:21 PM
Игорь Панасик