Geeks Talk

Prepare for your Next Interview




java forum

This is a discussion on java forum within the Java forums, part of the Software Development category; hi firiends what is difference between throw and throws keywords in java exception handling...


Go Back   Geeks Talk > Software Development > Java

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-22-2008
Junior Member
 
Join Date: Feb 2008
Location: bangalore
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kulkarni85 is on a distinguished road
Lightbulb java forum

hi firiends what is difference between throw and throws keywords in java exception handling
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-22-2008
Junior Member
 
Join Date: Feb 2008
Location: Pune
Posts: 11
Thanks: 5
Thanked 2 Times in 2 Posts
sforsree is on a distinguished road
Re: java forum

Hi kuklkarni,

Throws :- it is used to specify method level excetpion,to specify some statements in side a method level, when we are calling this type of methods we must handle the exceptions thrown by statements in the method.
eg :- public class ThrowEeg{
void m1() throws Exception
{
sop("");
a= a/0;
sop(a);//this line throws Exception.

sop(""); //this line dose n't excute
}
public static void main(String arg[])
{
ThrowEeg thre = new ThrowEeg();

try{ //here we call the try statement.

thre.m1();//method calling here.

}
catch(Exception e){
sop(e);
}
}

Throw :- it is generally use with user defined exceptions.to manually throw an exception use this key word.
Reply With Quote
Reply

  Geeks Talk > Software Development > Java


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Where is Introduction forum? thuongshoo Suggestions & Feedback 6 01-11-2008 08:01 AM
New to this forum nikhil_rattan Get Together 8 01-24-2007 07:52 PM
regarding GD forum vmshenoy Suggestions & Feedback 2 01-09-2007 01:15 AM


All times are GMT -4. The time now is 12:53 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved