bt0074 unit 6 faqs

Upload: sreilal

Post on 06-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Bt0074 Unit 6 Faqs

    1/1

    Frequently Asked Questions

    1

    Subject Name: OOPS with Java Subject Code: BT0074

    Unit 6: Exception HandlingBalasubramani R

    Assistant ProfessorDept. of IT

    Q1: What is an Exception?

    A1: The term exception denotes an exceptional event. It can be defined as an abnormal event

    that occurs during program execution and disrupts the normal flow of instruction.

    Q2: What are the Exception Classes?

    A2: The class at the top of the exception classes hierarchy is Throwable class. Two classes

    are derived from the Throwable class Error and Exception. The Exception class is used

    for the exceptional conditions that has to be trapped in a program. The Error class

    defines a condition that does not occur under normal circumstances.

    Q3: What are the common exceptions in Java?

    A3: Arithmetic Exception, NullPointer Exception and ArrayIndexOutOfBounds Exception.

    Q4: How will you implement exception-handling in your program?

    A4: You can implement exception-handling in your program by using following keywords:

    1. try

    2. catch

    3. finally

    Q5: What is ArrayIndexOutOfBounds Exception?A5: This exception is thrown when an attempt is made to access an array element beyond the

    index of the array. For example, if you try to access the eleventh element of an array that

    has only ten elements, the exception will be thrown.