Thursday, November 25, 2010

Menggunakan BufferedReader di Pemrograman Java

Assalamualaikum..
OK.. we are meet again,,, Now, I want publish somthing about Java Programing. First, you make 1 class with name JavaBufferedReader.java, and than you write this code in your project...


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 + "!");
}
}

After finish, compile program and run program.
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "Menggunakan BufferedReader di Pemrograman Java"

Post a Comment