Skip to content

Instantly share code, notes, and snippets.

@old-repo-ekoteguh
Created March 28, 2014 02:44
Show Gist options
  • Save old-repo-ekoteguh/9824144 to your computer and use it in GitHub Desktop.
Save old-repo-ekoteguh/9824144 to your computer and use it in GitHub Desktop.
Here is simple example of using conditional nested-if-else 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 PercabanganIfBersarang {
public static void main(String[] args) {
int i = 75;
//contoh percabangan if bersarang
if(i>=90){
System.out.println("cetak huruf A");
}else if(i>=80){
System.out.println("cetak huruf B");
}else if(i>=70){
System.out.println("cetak huruf C");
}else if(i>=60){
System.out.println("cetak huruf D");
}else if(i>=50){
System.out.println("cetak huruf E");
}else{
System.out.println("Huruf mutu F");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment