Answers for "bufferreader program used to add two numbers in java"

1

Java program to add two numbers using bufferedreader

// Java program to add two numbers using bufferedreader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class AddTwoBufferedReader 
{
   public static void main(String[] args) throws NumberFormatException, IOException 
   {
      int number1, number2, add;
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      System.out.println("Please enter two numbers to add: ");
      number1 = Integer.parseInt(br.readLine());
      number2 = Integer.parseInt(br.readLine());
      add = number1 + number2;
      System.out.println("Add two numbers using bufferedreader: " + add);
   }
}
Posted by: Guest on February-22-2021

Code answers related to "bufferreader program used to add two numbers in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language