Enter your email address:

    Delivered by FeedBurner

Exception


We know that no perfect program, and no consumer program which also perfect. Therefore, needed by an mechanism which assisting to handle mistake or error that happened, making moment goodness and also program implementation. Java provide mechanism in programming to handling the things is so-called with exception. Exception is event that happened when program meet mistake at program instruction moment run. Many matter able to generate this event, for example crash, damage hard disk out of a clear sky, so that programs do not can access certain files. Programmer even also can generate this event, for example by conducting the division of with number zero, or admission filling of element array exceed the amount of array element which is allocation etcetera. Exception consist of two kinds of group, that is :



  • Exception representing runtime exception subclass

  • Exception which non runtime exception subclass.

Runtime exception usually because of mistake of program or at design program. For example Null pointer exception which because of process of initializes imperfect program and Array index out of bounds exception caused to access array exceeding existing array capacities. In language of Java, on the happening of mistake, automatic will be thrown a object of is so-called exception, what then can be processed furthermore by readily functions handle the mistake. Process throwing of exception the is often recognized with term of throwing exception, while process acceptance of exception which is pertinent to be recognized with term of catch exception.

    1. Block of Try – Catch

For the handling of exception, in Java used by block of try and of catch. Block try used to place program codes of Java pregnant of code program which possible throw exception. block of Catch used to placing program codes of Java used to handle a certain exception. After us enhance block of try – catch to overcome error that happened, hence program will present message of error that there is error that happened at console.

    1. Object of Exception

Object of Exception yielded to earn we exploit to know furthermore regarding or error of exception that happened. Exception represent subclass of throw able class defining some method which also inherit by exception. Three important method is :

  • getMessage()

This Method return content order to depict exception happened.

  • printStackTrace()

This Method present message of and error of stack trace to standard of error output stream which usually represent console of windows if program representing console programs.

  • printStackTrace(PrintStream s)

This Method present message of error to object of print stream taken as parameter. If wishing to present message to console, we earn using System.Out as parameter.

    1. Block of Try – Catch – Finally

Besides try – catch, we earn to define block of try – and catch of finally which owning more complete process, because at finally we earn to define program code which is always executed, goodness there is exception that happened and also if do not happened exception is at all.

    1. Make New Class Exception

We earn to make new class which inherit exception class of java.lang.Exception. Anytime we need to define exception class which more specific for is certain, so that handling of exception earn more goodness.


We know that no perfect program, and no consumer program which also perfect. Therefore, needed by an mechanism which assisting to handle mistake or error that happened, making moment goodness and also program implementation. Java provide mechanism in programming to handling the things is so-called with exception. Exception is event that happened when program meet mistake at program instruction moment run. Many matter able to generate this event, for example crash, damage hard disk out of a clear sky, so that programs do not can access certain files. Programmer even also can generate this event, for example by conducting the division of with number zero, or admission filling of element array exceed the amount of array element which is allocation etcetera. Exception consist of two kinds of group, that is :



  • Exception representing runtime exception subclass

  • Exception which non runtime exception subclass.

Runtime exception usually because of mistake of program or at design program. For example Null pointer exception which because of process of initializes imperfect program and Array index out of bounds exception caused to access array exceeding existing array capacities. In language of Java, on the happening of mistake, automatic will be thrown a object of is so-called exception, what then can be processed furthermore by readily functions handle the mistake. Process throwing of exception the is often recognized with term of throwing exception, while process acceptance of exception which is pertinent to be recognized with term of catch exception.

    1. Block of Try – Catch

For the handling of exception, in Java used by block of try and of catch. Block try used to place program codes of Java pregnant of code program which possible throw exception. block of Catch used to placing program codes of Java used to handle a certain exception. After us enhance block of try – catch to overcome error that happened, hence program will present message of error that there is error that happened at console.

    1. Object of Exception

Object of Exception yielded to earn we exploit to know furthermore regarding or error of exception that happened. Exception represent subclass of throw able class defining some method which also inherit by exception. Three important method is :

  • getMessage()

This Method return content order to depict exception happened.

  • printStackTrace()

This Method present message of and error of stack trace to standard of error output stream which usually represent console of windows if program representing console programs.

  • printStackTrace(PrintStream s)

This Method present message of error to object of print stream taken as parameter. If wishing to present message to console, we earn using System.Out as parameter.

    1. Block of Try – Catch – Finally

Besides try – catch, we earn to define block of try – and catch of finally which owning more complete process, because at finally we earn to define program code which is always executed, goodness there is exception that happened and also if do not happened exception is at all.

    1. Make New Class Exception

We earn to make new class which inherit exception class of java.lang.Exception. Anytime we need to define exception class which more specific for is certain, so that handling of exception earn more goodness.


Qidzama

Recent Articles

Blog Archive