Answer Posted / gagan jain
common exceptions:
Java has several predefines exceptions. the most common
exceptions that you may encounter are described below.
Arithmetic Exception:-
This exception is thrown when an exceptional arithmetic
condition has occurred. for example, a division by zero
generates such an exception.
Nullpointer Exception:-
This exception is thrown when an application attempts to
use null where an object is required. An object that has
not been allocated memory holds a null value. the
situations in which an exception is thrown include:
1. Using an object without allocating memory for it.
2. Calling the methods of a null object.
3. Accessing or modifying the attributes of null obect.
ArrayIndexoutof Bounds Exception
The exception Arrayindexoutofbounds Exceptions is thrown
when an attempt is made to access an array element beyond
the index of the array. for example, if you try to access
the eleventh element of an array that's has only ten
elements, the exception will be thrown.
| Is This Answer Correct ? | 16 Yes | 9 No |
Post New Answer View All Answers
What is Gang of four design patterns
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
What is string and its types?
What is port number in java?
Explain what access modifiers can be used for variables?
What are the kinds of polymorphism?
Can abstract class have private constructor?
What data type is true or false?
Difference between keyword and identifier.
Does java trim remove newline?
What are advantages of using Java?s layout managers than windowing systems?
What is the purpose of final keyword and when to use it?
What is backdrop?
What does a void function return?
Does it matter in what order catch statements for filenotfoundexception and ioexception are written?