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 71 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
Thank you, thank you, thank you!
wrote...

Yesterday
Helped a lot
wrote...

2 hours ago
Thanks
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1424 People Browsing
Related Images
  
 13178
  
 1603
  
 178
Your Opinion
Who's your favorite biologist?
Votes: 586