Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Belajar Switch Case pake IF di Java
class BelajarSwitchCasePakeIf
{
public static void main(String[] args) {
int pilihan = 5;
if (pilihan==1) {
System.out.println("Selamat Anda menemukan HP!");
} else if (pilihan==2) {
System.out.println("Selamat Anda menemukan Pensil!");
} else if (pilihan>=3) {
System.out.println("Selamat Anda menemukan Spidol!");
} else {
System.out.println("Gelas itu ngga ada!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.