Here is Program to Demonstrate Skipping using Continue Statement.
Output of Above Java Program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 36 37 38 39 40 41 42 43 44 45 46 47 48 49
import java.io.*; class skip { public static void main(String [] args) { int a=1; while(a<50) { if(a>20 && a<=35) { a++; continue; } System.out.print("\t"+a); a++; } } }
Output of Above Java Program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 36 37 38 39 40 41 42 43 44 45 46 47 48 49