-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHataYonetimi.java
30 lines (27 loc) · 933 Bytes
/
HataYonetimi.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package SinavCalismalari;
import java.util.Scanner;
public class HataYonetimi {
public static void toplamaIslemi() {
int sayi1,sayi2;
Scanner input = new Scanner(System.in);
for (; ; ) {
try {
System.out.println("1. sayıyı giriniz.");
sayi1 = Integer.parseInt(input.nextLine());
break;
} catch (Exception exception) {
System.out.println("Harf değil sayı girmelisiniz.");
}
}
for (; ; ) {
try {
System.out.println("2. sayıyı giriniz.");
sayi2 = Integer.parseInt(input.nextLine());
break;
} catch (Exception exception) {
System.out.println("Harf değil sayı girmelisiniz.");
}
}
System.out.println("Sonuç= " + (sayi1+sayi2));
}
}