0% found this document useful (0 votes)
19 views1 page

T9N1 Driver

Uploaded by

Mr. X
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

T9N1 Driver

Uploaded by

Mr. X
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

*;

public class T9N1_driver{


public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Please enter two Integer: ");
int x1= 0, x2= 0;
boolean isValid = false;

while (!isValid) {
try
{
x1=input.nextInt();
x2=input.nextInt();
isValid=true;
}
catch(InputMismatchException e)
{
System.out.print("Wrong Input! Please input again :");
input.nextLine();
}
}
int result = x1 + x2;
System.out.println("The result is "+ result);
}
}

You might also like