GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 29 of 928    Print  
When is try,catch block used

  
Total Answers and Comments: 1 Last Update: August 25, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 25, 2005 07:33:11   #1  
swapna        

RE: When is try,catch block used
the code which has the probability of raising an exception is placed in the try block.
the code for handling the situation when an exception occurs is placed in the catch block with the instance of the exception as the parameter.
when an exception occurs the control is passed to catch block.

example

int a[5];

try()
{
try to access a[7]
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.Println( Out of Bounds );
}


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : the code which has the probability of raising an exception is placed in the try block. the code for handling the situation when an exception occurs is placed in the catch block with the instance of the exception as the parameter. when an exception ...

Latest Answer : Yes ...

Latest Answer : No.. ...
Read Answers (2) | Asked by : suresh

A sub class probabaly has more properties then that of super class , then why I am able to catch all exceptions by making the object of Exception class insted of its sub classes (while handling any exception by try,catsh,finally statement)?

Is it necessary to use catch block while using try block? Can anybody explain me about it in detail..

I have problem with threads implementation in servlets the problem is the servlets which uses instance variablesand if we pass request from two diff servers the o/p generated is mis matching with each other.i have also userd synchronized block but it is not working well(servlet not implementing the single thread model )
Read Answers (1) | Asked by : vishal

How to check infinity value ? i took very large number as string when i cast to float it gives infinity value. how to check at runtime or how to catch it?ex : String x = "111111111111111111111111111112222222222222222222222222222112222";System.out.println(Float.parseFloat(x));it gives infinity.so, how to catch it?

Anybody can explain how it is going to work and why it works soclass A{ int a; A() { a=20; }}class Myth{public static void main(String S[]){final A ob=new A(); class B extends Thread { B() { start(); } public void run() { for(int i=0;i
Read Answers (2) | Asked by : Rajesh

Latest Answer : yes u can write but acid properties of the transactions is not fullfil we get .we will not fullfil atomicity property.if we give commit in finally block . if we rollback the transaction in any situation it is not possible . because it will be commited ...
Read Answers (1) | Asked by : raju

Latest Answer : Static variables belongs to class only and they will execute when they are displayed in System.out.println() statement. By default they have a fixed value.e.g for integer 0for float 0.0Static block is executed before main() because it has no need of object ...
Read Answers (3) | Asked by : jitender


 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
 

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

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
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.  By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.  IT Certification offers several vari
 

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
 

Neuro-linguistic Programming Methods

Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
 

The Difficult Past of Neuro-linguistic programming

The Difficult Past of Neuro linguistic programming Neuro linguistic programming has had a rocky past with a number of lawsuits rivalry unsystematic development and intermittent progress During the 1980s the two founders separated after the lawsuit filed by Bandler Bandler went on to file several law
 

History of Neuro Linguistic Programming (NLP)

History of Neuro linguistic programming Neuro Linguistic Programming NLP is a system co founded by John Grinder and Richard Bandler for bringing about personal development in any individual by interpreting and translating the human perception experience beliefs and language It was developed in early
 

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