Start/ | End/ | |||
True | False | - | Line | Source |
1 | import java.io.BufferedReader; | |||
2 | import java.io.IOException; | |||
3 | import java.io.InputStreamReader; | |||
4 | public class io | |||
5 | { | |||
6 | int value; | |||
7 | ||||
10 | 0 | 8 | public boolean allowedValue() throws IOException //check if Value is an Integer && !0 | |
9 | { | |||
10 | BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); | |||
11 | String mystring = new String(); | |||
12 | mystring = console.readLine(); | |||
13 | ||||
10 | 0 | 14 | try | |
15 | { | |||
16 | Integer.parseInt(mystring); //check if Integer | |||
17 | value = Integer.parseInt(mystring); | |||
18 | ||||
9 | 1 | 19 | if (value != 0) //check if !0 | |
9 | 20 | return true; | ||
21 | else | |||
1 | 22 | return false; | ||
23 | } | |||
0 | - | 24 | catch(NumberFormatException err) //not an Integer | |
25 | { | |||
0 | - | 26 | return false; | |
27 | } | |||
28 | } | |||
29 | ||||
9 | 0 | 30 | public void test() | |
31 | { | |||
32 | Prime myPrime = new Prime(this.value); | |||
33 | ||||
4 | 5 | 34 | if (myPrime.isPrime()) | |
35 | System.out.println("ja"); | |||
36 | else | |||
37 | System.out.println("nein"); | |||
38 | } | |||
39 | ||||
40 | } | |||
41 | ||||
***TER 82% (9/11) of SOURCE FILE io.java |