im trying to throw exception from method,but when i compile the below code
class launcher{
public static void main(String[] args){
try{
getError();
System.out.println("Line: try block");
}catch(myException e){
System.out.println("Line: catch block");
}finally{
System.out.println("Line: finally block");
}
System.out.println("Line: EOF main");
}
static void getError() throws myException{
throw new myException();
}
}
compile error
launcher.java:14: error: cannot find symbol static void getError() throws ^myException{
symbol: class myException
location: class launcher
it says something, it can't understand what is myException
myException.java
and does it extendException
? – Elliott FrischmyException
byRuntimeException
. – dieter