GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 229 of 928    Print  
What is the functionality of try, catch and finally blocks

  
Total Answers and Comments: 2 Last Update: November 03, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 21, 2005 08:16:07   #1  
Pattukkottai Arun        

RE: What is the functionality of try, catch and finally blocks
The simple Try statement comes before the block of code the Catch block of code is where we specify what type of error to look for and the Finally block of code is always executed and contains cleanup routines for exception situations. Since the catch block is specific to the type of error we want to catch we will often use multiple Catch blocks in our Try...Catch...Finally structure.
 
Is this answer useful? Yes | No
November 03, 2005 04:35:40   #2  
Rajesh Sakhamuri        

What is the functionality of try, catch and finally blocks?
try&catch blocks are to get the error description.wothout try block there is no catch.finally contains compalsary statements to disconnect the database statement.wothout try there is no finally.By RAJESH
 
Is this answer useful? Yes | No

 Related Questions

A thread enters the waiting state when it blocks on I/O. 
Latest Answer : When a thread blocks on I/O, it enters to BLOCKED state. A thread enters WAITING state, while a thread calls wait(), and it will come back to READY state, while other threads call notify() or notifyAll(). The wait-notify model is called monitor pattern. ...

If a checked exception may be thrown within the body of a method, the method musteither catch the exception or declare it in its throws clause. 
Latest Answer : this rule is actually for handling the exceptions:that is there are two ways by ehich u can handle the exception :1:either you use the try catch statement and enclose the appropriate code in the try catch block,this is called as the catch or the HANDLE ...

The finally clause is used to provide the capability to execute code no matter whether ornot an exception is thrown or caught. 
Latest Answer : In try,catch clauses either try clause(If exception is not happend) or catch clause(If exception occures) is exicuted.If we want to exicute a block of statements doesn't depend on exception then we put those block of statements in finally ...

A catch clause can catch any exception that may be assigned to the Throwable type. Thisincludes the Error and Exception types. 

The finally clause of the try-catch-finally statement is always executed unless the threadof execution terminates or an exception occurs within the execution of the finally clause. 

What happens if a try-catch-finally statement does not have a catch clause to handlean exception that is thrown within the body of the try statement
The exception propagates up to the next higher level try-catch statement (if any) orresults in the program's termination. 

When an exception is thrown within the body of a try statement, the catch clauses of thetry statement are examined in the order in which they appear. The first catch clause that iscapable of handling the 
Latest Answer : If you are trying to catch the specific exception  ,  write that catch clause prior to the other / general clauses.Otherwise the compilation error "The Exception already been caught" will occur.Try this code:try {// some code}catch(Exception ...

Latest Answer : try&catch blocks are to get the error description.wothout try block there is no catch.finally contains compalsary statements,to disconnect the database statement.wothout try there is no finally.By RAJESH ...

Latest Answer : final is used for declaring a variable as a constant, final class can't be inherited, final methods cannot be overloaded but overridden  finally statement should execute not depending upon an exception is catch or thrown  finalize ...

Latest Answer : stubs: Marshall arguments transmitting to server Skeletons:unmarshall arguments pass to servant servant recieve the call for skeleton as local call ...


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Using UML with Java

Using UML with Java While Java is not a new language its application for the development of embedded systems is quite new Developers are beginning to take a second look at modeling languages such as UML and many feel it can be a powerful tool in their development arsenal mosgoogle center Introductio
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Java Technology Trends

Technology Trends Involving Java Java is an object oriented programming language OOP for Web browsers It is organized around data rather than actions and supports polymorphism which allows the same code to be written generically so it can function with different datatypes inheritance which allows on
 

The Building Blocks of ERP

The Building Blocks of ERP Enterprise Resource Planning is commonly used to improve the integration within companies and organizations and instead of focusing on individual parts the operations of the company are viewed as a whole Software infrastructure plays an important role in this process In ad
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape