Top Posters
Since Sunday
1
1
l
1
New Topic  
melinoma86 melinoma86
wrote...
Posts: 386
Rep: 0 0
4 years ago
Analyze the following code:

public class Test {
public static void main (String args[]) {
int i = 0;
for (i = 0; i < 10; i++);
System.out.println(i + 4);
}
}


▸ The program compiles despite the semicolon (;) on the for loop line, and displays 4.

▸ The for loop in this program is same as for (i = 0; i < 10; i++) { }; System.out.println(i + 4);

▸ The program has a compile error because of the semicolon (;) on the for loop line.

▸ The program compiles despite the semicolon (;) on the for loop line, and displays 14.
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


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

Related Topics

melinoma86 Author
wrote...

4 years ago
Thanks for your help!!
wrote...

Yesterday
Smart ... Thanks!
wrote...

2 hours ago
Thanks
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  764 People Browsing
Related Images
  
 247
  
 2782
  
 251
Your Opinion
Which industry do you think artificial intelligence (AI) will impact the most?
Votes: 380

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