Berikut Contoh Penggunaan BufferedReader pada Java :
import java.io.*;
class tugas
{public static void main (String args[])throws Exception
{
InputStreamReader keyreader=new InputStreamReader(System.in);
BufferedReader input=new BufferedReader(keyreader);
String s1,s2,s3,s4;
double n1,n2,n3,n4;
System.out.print("Masukan nama siswa:");
s1=input.readLine();
System.out.println("Masukan nilai UTS:");
s2=input.readLine();
System.out.println("Masukan nilai UAS:");
s3=input.readLine();
System.out.println("MasukanTugas mandiri:");
s4=input.readLine();
n1=Double.parseDouble(s2)*0.35;
n2=Double.parseDouble(s3)*0.45;
n3=Double.parseDouble(s4)*0.2;
n4=n1+n2+n3;
System.out.println("\nNilai aKHIR YG DIPEROLEH YAITU="+n4);
}
}
import java.io.*;
class tugas
{public static void main (String args[])throws Exception
{
InputStreamReader keyreader=new InputStreamReader(System.in);
BufferedReader input=new BufferedReader(keyreader);
String s1,s2,s3,s4;
double n1,n2,n3,n4;
System.out.print("Masukan nama siswa:");
s1=input.readLine();
System.out.println("Masukan nilai UTS:");
s2=input.readLine();
System.out.println("Masukan nilai UAS:");
s3=input.readLine();
System.out.println("MasukanTugas mandiri:");
s4=input.readLine();
n1=Double.parseDouble(s2)*0.35;
n2=Double.parseDouble(s3)*0.45;
n3=Double.parseDouble(s4)*0.2;
n4=n1+n2+n3;
System.out.println("\nNilai aKHIR YG DIPEROLEH YAITU="+n4);
}
}