membuat program biodata dengan scanner
codingnnya:
package net.belajarjava.CobaModul;
import java.io.*;
public class NomorSatu {
public static void main(String[] args) {
BufferedReader baca = new BufferedReader(new InputStreamReader(System.in));
String nDepan;
String nBelakang;
String alamat;
String kota;
String tmpLahir;
String tglLahir;
try{
System.out.println("Masukkan Data-data Anda :");
System.out.print("Nama Depan Anda : ");
nDepan = baca.readLine();
System.out.print("Nama Belakang Anda : ");
nBelakang = baca.readLine();
System.out.print("Alamat Rumah : ");
alamat = baca.readLine();
System.out.print("Kota : ");
kota = baca.readLine();
System.out.print("Tempat Lahir : ");
tmpLahir = baca.readLine();
System.out.print("Tanggal Lahir : ");
tglLahir = baca.readLine();
System.out.println(" ");
System.out.println("Outputnya :");
System.out.println("=============================================");
System.out.println(" Biodataku ");
System.out.println("=============================================");
System.out.println("Nama Lengkap : "+nDepan+" "+nBelakang);
System.out.println("Alamat : "+alamat+" "+kota);
System.out.println("Tempat, Tanggal Lahir : "+tmpLahir+", "+tglLahir);
}catch(Exception e){
System.out.println(e);
}
}
}
outputnya:
Tidak ada komentar:
Posting Komentar