What is the use of input stream reader in java or blue j?
Answers
Answered by
4
In InputStreamReader Method , the user can input the values in terminal window and can get the output in the terminal windows as well.
Example :
import java.io.*;
class InputStreamReader
{
static void test()throws IOException
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println(“Enter the first value “);
int fstval = Integer.parseInt(br.readLine());
System.out.println(“Enter the second value “);
int sndval = Integer.parseInt(br.readLine());
int sum = fstval+sndval;
int product = fstval-sndval;
System.out.println(“The sum of “+fstval+” and“+sndval+” is “+sum);
System.out.println(“The product of “+fstval+” and “+sndval+” is “+product);
}
}
Hope it Helps✌️✌️
Please mark me Brainliest
Example :
import java.io.*;
class InputStreamReader
{
static void test()throws IOException
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println(“Enter the first value “);
int fstval = Integer.parseInt(br.readLine());
System.out.println(“Enter the second value “);
int sndval = Integer.parseInt(br.readLine());
int sum = fstval+sndval;
int product = fstval-sndval;
System.out.println(“The sum of “+fstval+” and“+sndval+” is “+sum);
System.out.println(“The product of “+fstval+” and “+sndval+” is “+product);
}
}
Hope it Helps✌️✌️
Please mark me Brainliest
Anonymous:
Thanks bro
Answered by
0
Ask Google For it yoh will get answer
Similar questions