Question
this is Java Let's revisit chapter 5 example, but this time, no method can throw any exception out of the method and if an exception
this is Java
Let's revisit chapter 5 example, but this time, no method can throw any exception out of the method and if an exception was detected then you will have to throw your own custom exception to let the user know what happened.
public class Chapter10Demo{ public static void main(java.lang.String[] args) {method1();} private static void method1(){ method2();} private static void method2(){ method3();} private static void method3(){ method4();} private static void method4(){ method5();} private static void method5(){ method6();} private static void method6(){ java.io.File in=new java.io.File("somefile.txt"); java.io.File out=new java.io.File("somefile2.txt"); java.util.Scanner inFile=new java.util.Scanner(in); java.io.FileWriter outFile=new java.io.FileWriter(out); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started