Title: Analyze the following code: // Enter an integer Scanner input = new Scanner(System.in); int number = ... Post by: spruckj on May 5, 2020 Analyze the following code:
// Enter an integer Scanner input = new Scanner(System.in); int number = input.nextInt(); if (number <= 0)
▸ If number is positive, number is displayed. ▸ System.out.println(number); must be placed inside braces. ▸ number entered from the input cannot be negative. ▸ The if statement is wrong, because it does not have the else clause. ▸ If number is zero, number is displayed. Title: Analyze the following code: // Enter an integer Scanner input = new Scanner(System.in); int number = ... Post by: BobbyD on May 5, 2020 Content hidden
|