Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ooops, forgot to commit Testcase.java
- Loading branch information
floyd
committed
Aug 24, 2016
1 parent
5493a40
commit d66a56b
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | ||
import java.io.IOException; | ||
public class Testcase{ | ||
public native void nativeCrash(); | ||
public static void main(String args[]){ | ||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); | ||
try{ | ||
String s = in.readLine(); | ||
if(s == null || s.length() == 0){ | ||
System.out.println("Hum?"); | ||
System.exit(1); | ||
} | ||
if(s.charAt(0) == '0'){ | ||
System.out.println("Looks like a zero to me!"); | ||
//System.exit(134); //Doesn't work, although it looks "the same" in a bash $?, it's not the same, therefore: | ||
new Testcase().nativeCrash(); | ||
} | ||
else{ | ||
System.out.println("A non-zero value? How quaint!"); | ||
} | ||
System.exit(0); | ||
} | ||
catch(IOException ioe){ | ||
System.out.println("Hum?"); | ||
System.exit(1); | ||
} | ||
} | ||
} |