Contoh Program IF Menggunakan Java

Berikut adalah contoh program yang menggunakan IF pada java.

Listing Program :

import java.io.*;

class contohif
{
public static void main(String args[]) throws IOException
{
System.out.println("----------------------------------");
System.out.println("Pilihan Menu : ");
System.out.println("1. Menghitung Balok");
System.out.println("2. Sorting Angka");
System.out.println("3. Keluar");
System.out.println("----------------------------------");
//Membuat turunan class untuk Input dari User
BufferedReader kata = new BufferedReader
(new InputStreamReader(System.in));

System.out.print("Berapa nilai ujianmu ? [0-4] : ");
int pilihan = Integer.parseInt(kata.readLine());
double angka = Double.parseDouble(kata.readLine());

System.out.println("Anda memilih Menghitung Balok !" + pilihan+"dsd"+angka);
}
}

contoh coding java if then

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

If you want to leave a feedback to this post or to some other user´s comment, simply fill out the form below.

(required)

(required)