Explain about throw keyword?
Answers were Sorted based on User's Feedback
Answer / vibhor shukla
throw is used to throw an exception from any part of the
program not necessarily the method only.
whereas throws is particularly used to throw an exception
arising out of the use of a method to the exception handler
which is the catch block..
| Is This Answer Correct ? | 15 Yes | 1 No |
yes,its used to throw the user defined exception.
But its not always good habit to use throw exception.
Some times we can predict it will throw the exception.If we
know the error will come there in the earlier means why we
need to use the exceptions.we can solve it while writtting
code itself.
| Is This Answer Correct ? | 11 Yes | 4 No |
Answer / sabarish
in java , throw keyword is used to throw an exception which
cannot be trapped.
| Is This Answer Correct ? | 19 Yes | 16 No |
Answer / mandeswara rao
Before catching an exception it is must to be thrown first.
This means that there should be a code somewhere in the
program that could catch the exception. We use throw
statement to throw an exception or simply use the throw
keyword with an object reference to throw an exception. A
single argument is required by the throw statement i.e. a
throwable object.
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / rhietu negi
"Throw" keyword indicate that we forcefully want to thorow
an error
| Is This Answer Correct ? | 6 Yes | 6 No |
Answer / mahesh pyla
Throw is a keyword,which gives an indication to the calling
function to keep the called function with in try and catch
blocks for generating user friendly messages instead of
generating system error message.
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / ashima singh
The throw keyword is used when if a mehod is capable of
causing an exception that it does not handle.
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / sunil
throw keyword will throw an user defined exception
| Is This Answer Correct ? | 9 Yes | 16 No |
Answer / navin c. pandit
Hey guys don't confuse others if u don't know the actual ans.
The 'throw' keyword in C# throws a user defined exception.
| Is This Answer Correct ? | 7 Yes | 15 No |
How can I create image pieces/sub image?
What is the benefit of interface in c#?
what is software?
Do extension methods have to be static?
Is datetime nullable c#?
may we achieve polyphormsm through overloading a funtion?Is it right or wrong concept because i read polyphormism can be achieved through overloading?plz help me thnks
Hi to all..I have to create an intranet application on C#.NET windows Application so please please let can you people help me as iam new in .NET and if u have any samples or website address from where i can get sample please let know.
Explain constructor?
Can a constructor have a return type?
Explain the OOPS concept in C#?
how encapsulation is implemented in c#
How to create multi-dimensional array?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)