Question: Re-type the following and run, note incorrect behavior. Then fix errors in the code, which should print numStars asterisks. While (numPrinted 1 = numStars) {

 Re-type the following and run, note incorrect behavior. Then fix errors

Re-type the following and run, note incorrect behavior. Then fix errors in the code, which should print numStars asterisks. While (numPrinted 1 = numStars) { System.out.print("*"): } import java.util.Scanner: public class StarPrinter { public static void main (String args) { int numStars = 0: int numPrinted = 0: numStars = 12: numPrinted = 1: while (numPrinted !- numStars) { numPrinted = numPrinted*2: System.out.print("*"): } System.out.println(""): return: } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!