Jumat, 04 Mei 2012

Menggunakan BufferedReader di Pemrograman Java


import java.io.BufferedReader; // mengimpor class bafferedReader yang ada di package java.io
import java.io.InputStreamReader;
import java.io.IOException;

public class InputDgBufferedReader { // mendeklarasikan class bernama InputDgBufferedReader

public static void main(String[] args) { // mendeklarasikan method main

BufferedReader dataIn = new BufferedReader(new InputStreamReader (System.in));
String nama="";

System.out.print("Masukkan Nama Anda : ");

try {
nama = dataIn.readLine();
}
catch(IOException e) {
System.out.println("Error!");
}
System.out.println("Hello " + nama + "!");
}
}





sumber: http://betoi.blogspot.com

0 Comment :

Posting Komentar