0% found this document useful (0 votes)
8 views

Chapter 10 Exception handling Notes

Chapter 10 discusses exception handling in Java, categorizing errors into compile-time and run-time errors, and explaining the use of try, catch, and finally blocks for managing exceptions. It highlights the ability to create user-defined exceptions and the advantages of exception handling, such as maintaining program flow and managing run-time errors. Additionally, it provides information on compiling and executing Java files, along with the use of the Scanner class for input.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Chapter 10 Exception handling Notes

Chapter 10 discusses exception handling in Java, categorizing errors into compile-time and run-time errors, and explaining the use of try, catch, and finally blocks for managing exceptions. It highlights the ability to create user-defined exceptions and the advantages of exception handling, such as maintaining program flow and managing run-time errors. Additionally, it provides information on compiling and executing Java files, along with the use of the Scanner class for input.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CHAPTER 10 – EXCEPTION HANDLING IN JAVA

1. In Java , all kinds of error conditions are called exceptions.


2. There are two categories of Errors : Compile-time errors and Run-time errors.
3. Compile-time errors are the errors that occurred when we write the wrong syntax in
a program. (for e.g : forget to put Semicolon ( ; ) or incorrect commands name)
4. Exit code 0 suggest that program is executed successfully.
5. if a program is compiled successfully by compiler, then .class file is generated
automatically.
6. Shortcut key to compile java file is Ctrl + F7 and option Tool -> Compile
7. Run-time errors are the errors that take place while executing a program. (For e.g
insufficient memory can often trigger a runtime error)
8. Shortcut to execute our java file - F5 OR Tools -> Go
9. The java.lang and java.io package contains a hierarchy of classes dealing with
various exceptions.
10. List of all Exceptions is on Page no. 295 Table 10.2 with their work.
11. ArrayIndexOutOfBoundsException, ArithmeticException, FileNotFoundException
are the Exception names.
12. Exception handling is an object-oriented technique for managing ours errors.
13. Java uses keywords like try, catch and finally to write an exception handler .
14. A try block contains the code that may give rise to one or more exceptions.
15. A catch block contains the code that is intended to handle exception of a particular
type that were created in the associated try block.
16. A finally block is always executed before the program ends.
17. In a single program multiple exceptions can occur.
18. Each try block must always be followed by at least one block that is either a catch
block or a finally block.
19. Java allows creating our own exception classes according to application-specific
problems which is called User-defined exception.
20. User-defined exceptions can be created by creating a subclass of Exception class.
21. User-defined exception can be thrown explicitly using throws statement.
22. Advantages of Exception Handling is given on Pg.no. 217 . that is maintain normal
flow of program, separated program code, handle run-time error easily etc.
23. import java.util.Scanner class is used to accept input from the keyboard.
24. Using kbinput.nextInt() method , integer values can be accepted using scanner class.

Textual MCQ Answers:


1 – c , 2 – b , 3 – d , 4 – b, 5 – b, 6 – c , 7 – c, 8 – c , 9 – c, 10 - c

You might also like