Interaction with keyboard
class sample
{
public static void main(String asd[])
{
DataInputStream din =new DataInputStream(System.in);
try{
int x=Integer.valueOf(din.readLine()).intValue();
int y=Integer.valueOf(din.readLine()).intValue();
int sum=x+y;
System.out.println(“Addition=”+sum);
}catch(IOException s){}
}
}
Instead of Integer.valueOf(din.readLine()).intValue() you should just write Integer.parseInt(din.readLine())
ReplyDelete