Find Error Chapter 5 6E of Starting Out With Java byGladdis
Find the errors in the following code.
1. // This code contains ERRORS!
// It adds two numbers entered by the user.
int num1, num2;
String input;
char again;
Scanner keyboard = new Scanner(System.in);
while (again == ‘y’ || again == ‘Y’)
System.out.print(“Enter a number: “); num1 =keyboard.nextInt();
System.out.print(“Enter another number: “; num2 =keyboard.nextInt();
System.out.println(“Their sum is “+ (num1 + num2));
System.out.println(“Do you want to do this again? “);
keyboard.nextLine(); // Consume remaining newline
input = keyboard.nextLine();
again = input.charAt(0);
Expert Answer
An answer will be send to you shortly. . . . .