Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is difference between throw and throws in exception?

Answer Posted / ishan gupta

Whenever We Handle the exception through THROW we used to write
a handler for handling that Exception that is "CATCH BLOCK".It is done Explicitly by The programmer
EX:-
public static void main(String[] args) {

int a=4;
int b=0;
int c=0;
try
{
c=a/b;
throw new ArithmeticException();
}
catch(ArithmeticException o){
System.out.println("Exception Catched");
}

}

Whenever We Handle the exception through THROWS than We are not worriyng about handling the Exception As this work is done by the JVM
Ex-

public static void main(String[] args)throws ArithmeticException {
int c=4/0;

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which collection is sorted in java?

982


When should the method invokelater() be used?

976


What is prefix of a string?

977


Which sort is best in java?

906


Can we rethrow the same exception from catch handler?

1081


Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.

1951


What is treemap in java?

899


What does those terms actually mean included in the j.d.k i.6?

2072


How many bits is a string in java?

972


Is 0 true or false?

946


Which oo concept is achieved by using overloading and overriding?

952


What is called module?

925


Are arrays static in java?

1008


Is a string literal?

1004


Explain about class in java?

1048