fork(1) download
  1. class someClass {
  2. public int value;
  3.  
  4. public someClass() {
  5. value = 1;
  6. try {
  7. value++;
  8. if (value == 2) {
  9. throw new Exception("value is 2");
  10. }
  11. } catch (Exception e) {
  12. System.out.println("I caught an exception.");
  13. throw new Exception("Does this exception get thrown upwards?");
  14. } finally {
  15. return;
  16. }
  17. }
  18. }
  19.  
  20. class anotherClass {
  21. public static void main(String[] args) {
  22. try {
  23. someClass someclass = new someClass();
  24. } catch (Exception e) {
  25. e.printStackTrace();
  26. }
  27. }
  28. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
I caught an exception.