Question: Hi I need help debugging this code in JAVA! Need to stop my while loop from running after a certain number of lines when the

 Hi I need help debugging this code in JAVA! Need to

Hi I need help debugging this code in JAVA! Need to stop my while loop from running after a certain number of lines when the input from console ends. Currently it is in an infinite loop in while and I've tried a few things to stop after the lines are done but i just cant figure it out :/

FINAL CODE: Should take input and output row with *'s in the row of how many of that letter was found in all lines of code. I figured out how to do most of the code, but it only worked for one line!! So stuck on this, thank you for the help!

EXAMPLE INPUT:

aaaabbbb ccc&%

xxyyyyy zz eee

package histogram; import java.util.*; //import java.Lang.Math public class Histogram2 public static void main(String [] args) Scanner scnrnew Scanner(System.in); int[l numStars new int [26]; while(scnr.hasNextLine()) //Scanner lineScanner -new Scanner(scnr.nextLine)) char[] input scnr.nextLine().toCharArray); /ADD STARS for (char scanInput: input) if (scanInput 97 && scanInput

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!