Java Programming Switch Case.docx

  • Uploaded by: Aphroditety Z
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Java Programming Switch Case.docx as PDF for free.

More details

  • Words: 118
  • Pages: 3
Java programming flow charts Four types of control statements Conditional statements

a) if statement b) nested if statement c) if-else statement d) if-else-if statement

1. Switch Case statement

Page 1 of 3

public class SwitchCaseExample2 { public static void main(String args[]){ int i=2; switch(i) { case 1: System.out.println("Case1 "); case 2: System.out.println("Case2 "); case 3: System.out.println("Case3 "); case 4: System.out.println("Case4 "); default: System.out.println("Default "); } } }

Switch Case break statement public class SwitchCaseExample2 { public static void main(String args[]){ int i=2; switch(i) { case 1: System.out.println("Case1 "); break; case 2: System.out.println("Case2 "); break; case 3: System.out.println("Case3 "); break; case 4: System.out.println("Case4 "); break; default: System.out.println("Default "); }

Page 2 of 3

} }

Page 3 of 3

Related Documents


More Documents from ""