Friday 30 November 2012

THROW KEYWORD

THROW KEYWORD:-
       Sometimes we can make Exception to this rule item clearly and we can handover that exception things to the JVM clearly by throw keyword and key phrase. The objective of throw keyword and key phrase is to handover our make exception item object clearly to the JVM.

EXAMPLE1:
 category Test{
                  community fixed gap primary (string[] args){
                      program.out.println(10/0);
                }
                 }

                  In this situation arithmeticException item designed unquestioningly and handover to the JVM instantly by the primary method

EXAMPLE 2:-
   category Test{
                    community fixed gap main(string[] args) {
                       throw new arithmeticexception("/by Zero");
                         }
                   }

                    In this situation development of an item and handover to the JVM clearly by the programmer

NOTE:-
      (i) After throw announcement we are not allow to placed any declaration straight breach leaded to gather time mistake saying remote declaration.
(ii)It is possible to tossed any throwable kind such as error
(iii) we can use throw keyword and key phrase only for throwable things otherwise we will get gather time mistake saying unique type

No comments:

Post a Comment