Question: simple System.out.println Java program How do I solve this error, Error:(22, 28) java: variable msb might not have been initialized: Please fix the error also.

simple System.out.println Java program

How do I solve this error, Error:(22, 28) java: variable msb might not have been initialized: Please fix the error also. You can ignore line 14 to 18, I'm really focused on 20 to 28. After the user types a set of number, the largest number gets saved to the variable. How do I solve this issue?

Help with:

1. System.out.println("blah blah" + maxDigit(msb));

2. Put a limit, the user must enter no more than 3 digits for int msb.

simple System.out.println Java program How do I solve this error, Error:(22, 28)

Please send me a photo. If you don't want to or can't, you can paste the answer. Thank you in advance!

10D public static void main(String[] args) t Scanner scannew Scanner(System.in); 12 13 14 15 16 17 18 19 20 21 try (scan) t System.out.println("Please enter serial number: "); int msb = Integer.parseInt(getInput(scan, prompt: "Enter an integer: ")); // user inputs serial number maxDigit(msb)); System.out.println("The MSB of the serial number is: " System.out.println("What is the weight?"); double weight -scan.nextInt); // user input weight int msb = maxDigit(msb); 23 24 25 26 27 28 29 30 if(weight > 60) System, out.println ("Item + maxDigit(msb) + " is " + weight + "kg. Moved to station " + maxDigit(msb)); else t System.out.println("Item "+ maxDigit(msb) is " weight + "kg. Moved to station 7.")

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!