Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference  RSS feed

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is Difference between throw and throws ?
 
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

vineet walia wrote:what is Difference between throw and throws ?



any body also provide example to explain this?
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or have a look at this thread:

Exception handling throw and throws
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's always wise to search the ranch. There's always lots of great wisdom to be had!

-Cameron McKenzie
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!