4.EXCEPTION HANDLING IN JAVA
4.EXCEPTION HANDLING IN JAVA Source Code: import java.io.*; class Predefined{ void ArithmeticExcp(){ try{ int a=20,b=0,c; c=a/b; System.out.println("Result:"+c); } catch(ArithmeticException e){ System.out.println("Arithmetic Exception:Division by zero"); } } void StrindOutofBoundExcp(){ try{ String s="Java Programming"; char c=s.charAt(25); System.out.println(c); } catch(StringIndexOutOfBoundsException e) { System.out.println("String out of Bound Exception:character Index out of Range"); } } void ArrayOutofBoundExcp(){ try{ int a[]=new int[5]; a[8]=9; } catch(ArrayIndexOutOfBoundsException e) { System.out.println("Array out of Bound Exception: Index out of Range"); } } void FileNotFoundExcp() throws FileNotFoundException{ try{ File file=new File("D://sample.txt"); FileReader fr=new FileReader(file); } catch(FileNotFoundException e) { System.out.println("File Not Found Exception: File does not exist"); } } } public...