The following statement is supposed to print the integers from 1 to 10, but it contains an error.  for (i = 1; i >= 10; i++) System.out.println(i); A.) What will be printed when the statement is executed? B.) Describe the error and show how to fix it.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter5: Making Decisions
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

The following statement is supposed to print the integers from 1 to 10, but it contains an error. 

for (i = 1; i >= 10; i++)

System.out.println(i);

A.) What will be printed when the statement is executed?

B.) Describe the error and show how to fix it.

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Literals
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning