fork download
  1. public class Main {
  2. public static void main(String[] args) {
  3. java.util.Scanner scanner = new java.util.Scanner(System.in);
  4. while (true) {
  5. try {
  6. int int0 = Integer.parseInt(scanner.nextLine());
  7. int int1 = Integer.parseInt(scanner.nextLine());
  8. System.out.println(int0 % int1);
  9. } catch (ArithmeticException e) {
  10. System.out.println("java.lang.ArithmeticException: / by zero");
  11. } catch (NumberFormatException e) {
  12. System.out.println("java.lang.NumberFormatException: For input string");
  13. } finally {
  14. if (scanner.nextLine().equals("q")) {
  15. break;
  16. }
  17. }
  18. }
  19. }
  20. }
  21.  
Runtime error #stdin #stdout #stderr 0.14s 51068KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.util.NoSuchElementException: No line found
	at java.base/java.util.Scanner.nextLine(Scanner.java:1651)
	at Main.main(Main.java:14)