Question: The following program works, but its ugly. Modify it to perform the same function with a more conventional while loop. import java.util.Scanner; public class Test
The following program works, but it’s ugly. Modify it to perform the same function with a more conventional while loop.
![import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner stdIn = new](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1704/8/6/4/970659e2cca055621704864966826.jpg)
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner stdIn = new Scanner (System.in); String all Entries=""; for (String entry=""; ;) { System.out.print("Make entry or 'q' to quit: "); entry if (entry.equals("q")) break; else allEntries += " + entry; } // end for = stdIn.nextLine(); System.out.println(allEntries); } // end main } // end class Test
Step by Step Solution
3.48 Rating (155 Votes )
There are 3 Steps involved in it
The given Java program uses a for loop without its usual initialization condition and increment expr... View full answer
Get step-by-step solutions from verified subject matter experts
