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

What is arraylist e in java?

1103


Why is java multithreaded?

1042


Can we declare a constructor as final?

1392


Explain java coding standards for methods?

1084


Does constructor be static?

1083


What will be the initial value of an object reference which is defined as an instance variable?

1194


Explain about fail fast iterators in java?

1115


What’s the difference between constructors and other methods?

1046


How do you empty a list in java?

1016


Can we sort set in java?

1005


What are locale settings?

1031


How an object is serialized in java?

1031


What is indexof in java?

1051


What is a void method?

965


What is the difference between abstraction and encapsulation?

1089