Top Posters
Since Sunday
5
o
5
4
m
4
b
4
x
4
a
4
l
4
t
4
S
4
m
3
s
3
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 70 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
Thanks for your help!!
wrote...

Yesterday
Just got PERFECT on my quiz
wrote...

2 hours ago
I appreciate what you did here, answered it right Smiling Face with Open Mouth
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  887 People Browsing
 107 Signed Up Today
Related Images
  
 691
  
 4391
  
 278
Your Opinion
Where do you get your textbooks?
Votes: 284

Previous poll results: What's your favorite coffee beverage?