Java: custom-exception-error
- by HH
$ javac TestExceptions.java
TestExceptions.java:11: cannot find symbol
symbol : class test
location: class TestExceptions
throw new TestExceptions.test("If you see me, exceptions work!");
^
1 error
Code
import java.util.*;
import java.io.*;
public class TestExceptions {
static void test(String message) throws java.lang.Error{
System.out.println(message);
}
public static void main(String[] args){
try {
// Why does it not access TestExceptions.test-method in the class?
throw new TestExceptions.test("If you see me, exceptions work!");
}catch(java.lang.Error a){
System.out.println("Working Status: " + a.getMessage() );
}
}
}