Skip to content

Instantly share code, notes, and snippets.

@old-repo-ekoteguh
Created March 28, 2014 02:45
Show Gist options
  • Save old-repo-ekoteguh/9824163 to your computer and use it in GitHub Desktop.
Save old-repo-ekoteguh/9824163 to your computer and use it in GitHub Desktop.
Here is simple example of using conditional swirch-case in Java programming.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.dekteguh.percabangan;
/**
*
* @author Eko Teguh Widodo
*/
public class PercabanganSwitchCase {
public static void main(String[] args) {
int angka = 52;
switch (angka) {
case 1:
System.out.println("cetak 1");
break;
case 2:
System.out.println("cetak 2");
break;
case 3:
System.out.println("cetak 3");
break;
case 4:
System.out.println("cetak 4");
break;
case 5:
System.out.println("cetak 5");
break;
default:
System.out.println("jangan cetak angka");
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment