fork download
  1. class Exception1 extends Exception
  2. class Exception2 extends Exception
  3. class Exception3 extends Exception
  4.  
  5. object Main {
  6. def main(args: Array[String]) {
  7. try {
  8. // jakiś kod
  9. } catch { x =>
  10. println("Exception")
  11. println(x match {
  12. _: Exception1 => "1"
  13. _: Exception2 => "2"
  14. _: Exception3 => "3"
  15. _ => "Unknown"
  16. })
  17. }
  18. }
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
2
10
42
11
compilation info
Main.scala:11: error: '}' expected but ';' found.
      println(x match {
^
Main.scala:12: error: 'case' expected but '_' found.
        _: Exception1 => "1"
        ^
Main.scala:13: error: '}' expected but ';' found.
        _: Exception2 => "2"
^
Main.scala:16: error: ';' expected but ')' found.
      })
       ^
Main.scala:18: error: eof expected but '}' found.
  }
  ^
5 errors found
spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout
Standard output is empty