Question: Inspect the following code for syntax errors, correct the error by stating the line number and re-write the line of code involved. You do not
Inspect the following code for syntax errors, correct the error by stating the line number and re-write the line of code involved. You do not have to re-write the entire program. There are six errors.
1 import java.lang.Scanner;
2
3 public class PositiveNegative
4 {
5 public static main(String [] args)
6 {
7 double number = 0;
8
9 Scanner input = new Scanner(system.in);
10
11 System.out.print("Enter a number ==> ");
12 number = input.nextDouble()
13
14 if (number < 0) then
15 System.out.println("Negative ");
16 else
17 System.out.println("Positive");
18 )
19 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
