throwit.java 593 B

12345678910111213141516171819202122232425262728293031323334
  1. // Test to see if throw works.
  2. public class throwit
  3. {
  4. static
  5. {
  6. System.loadLibrary ("throwit");
  7. }
  8. public static native void throwit (String name, boolean is_new);
  9. public static void main (String[] args)
  10. {
  11. try
  12. {
  13. throwit ("java/lang/UnknownError", false);
  14. }
  15. catch (Throwable x)
  16. {
  17. System.out.println (x.getClass ());
  18. System.out.println (x.getMessage ());
  19. }
  20. try
  21. {
  22. throwit ("java/lang/Throwable", true);
  23. }
  24. catch (Throwable x)
  25. {
  26. System.out.println (x.getClass ());
  27. System.out.println (x.getMessage ());
  28. }
  29. }
  30. }