- Q State the working rule to determine extreme value of the function f(x,y)
- Q Can i return (twisted) deferreds from signal handlers?
- Q What does invoke built-in do?
- Q Illustrate the appendages of prawn.
- Q What modular programming?
- Q How to install rpm packages in redhat & centos linux ?
- Q A person vows to do a thing if his wish is granted by Allah Ta’ala. After sometime when his wish is still unfulfilled can the person cancel the “Nazr” (vow)?
- Q what are the guidelines to follow to buy a YouTube Channel?
- Q What is difference between List < ? > and List < Object > in Java
- Q What is the point of studying English?
- Q You’re a new addition to the crayon box, what color would you be and why?
Question
How can an exception be thrown manually by a programmer?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software, Java, programmers,
Answers
In order to throw an exception in a block of code manually, throw keyword is used. Then this exception is caught and handled in the catch block.
Java
public void topMethod(){
try{
excMethod();
}catch(ManualException e){ }
}
public void excMethod{
String name=null;
if(name == null){
throw (new ManualException("Exception thrown manually ");
}
} 123456789101112
public void topMethod(){try{excMethod();}catch(ManualException e){ }} public void excMethod{String name=null;if(name == null){throw (new ManualException("Exception thrown manually ");}}
Your Comment
Java
public void topMethod(){
try{
excMethod();
}catch(ManualException e){ }
}
public void excMethod{
String name=null;
if(name == null){
throw (new ManualException("Exception thrown manually ");
}
} 123456789101112
public void topMethod(){try{excMethod();}catch(ManualException e){ }} public void excMethod{String name=null;if(name == null){throw (new ManualException("Exception thrown manually ");}}
Your Comment
- 0
- 0
- New Answer
- Contributors: *,
More Software,Java,programmers Questions..
What is the inputsplit in map reduce software?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Can variables be used in Java without initialization?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is the difference between java bean and enterprise java bean?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What is software configuration management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How does the java database connectivity (jdbc) work?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Java,
What are the advantages of threads in java?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Java,
What Is Java Api For Xml-based Rpc (jax-rpc)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
How can you implement fine-grained auditing?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is IBM’s simple explanation for Big Data’s four critical features?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is static synchronized method in JDBC API? Give an example?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
What does the NULLIF function do?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What happens if a start method is not invoked and the run method is directly invoked?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Should we override finalize method
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
what is the difference between mysql_fetch_array and mysql_fetch_object?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How will XML affect my document links?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is object cloning in Java?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 0 )
- Tags: Java,
Why to use Style Sheets?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are Filters in MVC?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Can you explain Application layer in OSI model?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How to define new testplan attributes?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,