Top Posters
Since Sunday
5
a
5
k
5
c
5
B
5
l
5
C
4
s
4
a
4
t
4
i
4
r
4
New Topic  
spruckj spruckj
wrote...
Posts: 435
3 years ago
Analyze the following code:

// Enter an integer
Scanner input = new Scanner(System.in);
int number = input.nextInt();

if (number <= 0)
System.out.println(number);


▸ 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.
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 73 times
1 Reply
Replies
Answer verified by a subject expert
BobbyDBobbyD
wrote...
Posts: 381
3 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

spruckj Author
wrote...

3 years ago
I appreciate what you did here, answered it right Smiling Face with Open Mouth
wrote...

Yesterday
You make an excellent tutor!
wrote...

2 hours ago
This calls for a celebration Person Raising Both Hands in Celebration
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1250 People Browsing
Related Images
  
 240
  
 603
  
 316
Your Opinion
What's your favorite coffee beverage?
Votes: 274