English

Give an example to illustrate null loop.

Advertisements
Advertisements

Question

Give an example to illustrate null loop. 

Answer in Brief
Advertisements

Solution

The example of null loop by using for statement is as shown below:

for(j = 1; j <= 10; j++) 
{} 

There is no statement enclosed under curly braces. Hence, the loop simply repeats 10 times.

shaalaa.com
  Is there an error in this question or solution?
Chapter 1.09: Iterative Constructs in Java - Review Insight [Page 120]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.09 Iterative Constructs in Java
Review Insight | Q 4. | Page 120
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×