File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference" Watch "Difference" New topic
Author

Difference

vineet walia
Ranch Hand

Joined: Feb 16, 2008
Posts: 138
what is Difference between throw and throws ?
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

The letter 's'.

A method declares the exceptions it throws with the throws clause. When you actually create an exception, you throw it.

-Cameron McKenzie
vineet walia
Ranch Hand

Joined: Feb 16, 2008
Posts: 138
vineet walia wrote:what is Difference between throw and throws ?


any body also provide example to explain this?
John Bengler
Ranch Hand

Joined: Feb 12, 2009
Posts: 133
Or have a look at this thread:

Exception handling throw and throws
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

It's always wise to search the ranch. There's always lots of great wisdom to be had!

-Cameron McKenzie
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

The letter 's'.




throws tells you that a method throws some sort of exception. With throw you well, umm, throw an exception from the method.



SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference