How Do You Define A Java Exception?
When computer programs are executing, errors can arise from one of two sources: unpredicted user interaction or a programmer error. Normally, it is more desirable for the program to be able to identify the error so that a programmatic fix can be created to fix the problem instead of allowing the program to continue and potentially crash without providing information to fix the error. In Java, the Exception class was created to transfer control of the program to a predefined block of programming code to allow the developer to create predefined actions to take in the event of an error. Creating a Java Exception is a common task for the Java programmer. Open your computer’s text editor and save the file as “TestFile.java” to the computer’s C: drive on a Windows computer. Type the following code in the TestFile.java file to create a development environment to define a Java exception: Public static void main (String[] args) { InputStream myInputStream; File myFile; } Start the exception han