what is the difference between writing a catch block which catches Exception object and catch block which catches Error object? when I am writing Only Error catch block it executes and catches the exception the same result as an exception but when writing with two catch block it executes exception catch block instead of catch block of error. someone can explain in detail.
public class Main
{
public static void main(String[] args) {
int a=1,b=0;
try{
System.out.println(a/b);
}catch(Error e){
System.out.println("error"+e);
}
catch(Exceptione){
System.out.println("exception"+e);
}
}
}