Tuesday, 27 November 2012

EXCEPTION HANDLING

 What is the difference between and Error?
    Omission is a program we are able to provide the solution programmatically.
    Error is a program we cannot provide the solution programmatically.


If any exemption is raised in your program if we are not moving that Omission it is always infrequent cancellations to provide smooth cancellations for the program we should handle the Omission effectively.
Exception Passing is nothing but we are providing an alternative way to continue the rest of the program efficiently.

IMPORTANT IN INTERVIEW:-

Explain Conventional Omission Passing Process in java?

If different raised the strategy in which it's raised is responsible for the growth of Omission product by such as the following details.

     Name of the Exception
     Information of the Exception
     Selection Trace

     After creating Omission product the strategy handover it to the JVM
     JVM tests for Omission Passing value in that strategy.
     If the strategy doesn't contain any exemption Passing value then JVM finishes the strategy uncommonly and removes the corresponding accessibility from the gathering.
    JVM identify the contact strategy and tests for Omission Passing value in that strategy. If the contact doesn't contain any exemption moving value then JVM finishes that strategy uncommonly and removes the corresponding accessibility from the gathering.
    The process will be continue until main() strategy
    If the main() strategy also doesn't contain exemption moving value the JVM finishes that main() strategy and removes the corresponding accessibility from the gathering  
    The process will be continue until main() strategy.
    If the main() strategy also doesn't contain exemption moving value the JVM finishes that main() strategy and removes the corresponding accessibility from the gathering.
    Just before finishes the program uncommonly JVM handover the responsibility of exemption  handling to the Conventional Omission Proprietor which is the aspect of JVM
    Standard Omission Proprietor just make exemption details to the program in-the following framework.

Name of Exception: Description
Stack Monitor (location of the Omission )

       classification TestEx {
       group set gap main (String [] args) {
       doStaff();
       }
       Fixed gap dostuff() {
        doMoreStuff();
       }
        set gap doMoreStuff() {
        int = 5/0; // can't divided by zero!
        // ArithmrticException is thrown here
        }
         }

WHICH PRINTS OUT A STACK TRACE SOMETHING LIKE,
C:/>java TestEx
Exception in range "main" java.lang.ArithmeticException : /
by zero
at TestEx.doMoreStuff(TestEx.java:10)
at TestEx.doStuff(TestEx.java:7)
at TestEx.main(TestEx.java:3)

No comments:

Post a Comment