backup
This commit is contained in:
20
6/Aufgabe2.~ava
Normal file
20
6/Aufgabe2.~ava
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
public class Aufgabe2 {
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
System.out.println(berechneDivision(10,5));
|
||||
} catch(IllegalArgumentException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static int berechneDivision(int a, int b){
|
||||
if (b == 0){
|
||||
throw new IllegalArgumentException("Der Nenner darf nicht Null sein");
|
||||
}
|
||||
int c = a/b;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user