You are on page 1of 1

import java.io.*; class add { int a,b,s; public void accept() throws IO Exception { InputStreamReader ir=new InputStreamReader(System.

in); BufferedReader br=new BufferedReader(ir); system.out.println("\nenter 2 numbers"); a=Integer.parseInt(br.readLine()); b=Integer.parseInt(br.readline()); } public void calculate() { s=a+b; } public void display() { system.out.println("sum of 2 numbers is= " +s); } } class my_add { public static void main(string ar[]) throws IO Exception { add a=new add(); a.accept(); a.calculate(); a.display(); }}

You might also like