//Program for Buffered Reader Input
//Developed by Ahlam Ansari
import java.io.*;
class BuffrdReaderInput
{
public static void main (String ahlam[]) throws IOException
{
int intData;
String stringData;
float floatData;
char charData;
InputStreamReader isr = new InputStreamReader( System.in );
BufferedReader br = new BufferedReader( isr );
//BufferedReader br = new BufferedReader(new InputStreamReader( System.in ));
charData = (char) br.read();
intData = Integer.parseInt(br.readLine());
floatData = Float.parseFloat(br.readLine());
stringData = br.readLine();
System.out.println( "CharData="+charData+"\nIntData= " + intData + " \nFloatData= " + floatData + "\nStringData= " + stringData);
}
}
/*
Output
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>javac BuffrdReaderInput.java
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>java BuffrdReaderInput
@1
1.2
Ahlam
CharData=@
IntData= 1
FloatData= 1.2
StringData= Ahlam
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>
*/
//Developed by Ahlam Ansari
import java.io.*;
class BuffrdReaderInput
{
public static void main (String ahlam[]) throws IOException
{
int intData;
String stringData;
float floatData;
char charData;
InputStreamReader isr = new InputStreamReader( System.in );
BufferedReader br = new BufferedReader( isr );
//BufferedReader br = new BufferedReader(new InputStreamReader( System.in ));
charData = (char) br.read();
intData = Integer.parseInt(br.readLine());
floatData = Float.parseFloat(br.readLine());
stringData = br.readLine();
System.out.println( "CharData="+charData+"\nIntData= " + intData + " \nFloatData= " + floatData + "\nStringData= " + stringData);
}
}
/*
Output
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>javac BuffrdReaderInput.java
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>java BuffrdReaderInput
@1
1.2
Ahlam
CharData=@
IntData= 1
FloatData= 1.2
StringData= Ahlam
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>
*/
No comments:
Post a Comment