





















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















































INDEX
class example { public static void main (String p[]) { into a=10, b=5; if (a>b) { System.out.println (a); } } }
OUTPUT:- 10
3.//Program of Else if ladder
class execute { public static void main (String p[]) { into a=10, b=10; if (a>b) { System.out.println(a); } else if(b>a) { System.out.println(b); } else { System.out.println("equal"); } } }
equal
4.//Program of Switch case
class Switchcase { public static void main (String args []) { into day=4; switch (day) { case 0: System.out.println ("Sunday"); break; case 1: System.out.println ("Monday"); break; case 2: System.out.println ("Tuesday"); break; case 3: System.out.println ("Wednesday"); break; case 4: System.out.println ("Thursday"); break;
5.//Program of While statement
class loop { public static void main (String p[]) { into i=1;
while (i<5) { System.out.println (i); i++; } } }
Output:- 1 2 3 4
6.//Program of Do while statement
class Dowhile { public static void main (String args[]) { into i=1; do { System.out.println (i); i++; } while (i< 10); } }
7.//Program of For loop statement
class For {
for (i=1; i<5; i++) { if (i==2) { System.out.println (i); break; } } } }
9.//Program of Continue statement
class Continue { public static void main (String args[]) { for (into i = 1; i < 100; i++) { System. out. println (" "); if (i >= 8)
break; for (into j = 1; j < 100; j++) { System. out. print (" * "); if (j == i) continue LOOP1; } } System.out.println ("BREAK"); } }