Skip to content

Tag Archives: Exception Handling

In this article, the enhancements made by Oracle in version 1.7, along with its implementation, has been discussed. As a part of 1.7 version enhancement,… Read More
In Ruby, exception handling is a process which describes a way to handle the error raised in a program. Here, error means an unwanted or… Read More
Prerequisite: Throw and Throws in Java The differences between throw and throws are: Point of usage throw keyword is used inside a function. It is… Read More
In Java, there are three methods to print an exception information. All of them are present in Throwable class. Since Throwable is the base class… Read More
  throw The throw keyword in Java is used to explicitly throw an exception from a method or any block of code. We can throw… Read More
NullPointerException is a RuntimeException. In Java, a special null value can be assigned to an object reference. NullPointerException is thrown when program attempts to use… Read More
Consider the following code snippets: public class Geeksforgeeks {     public static void main(String[] args)     {         double p = 1;         System.out.println(p/0);     } } Output: Infinity public… Read More
Predict the output of the following program. class Test {   int count = 0;        void A() throws Exception     {         try         {             count++;                            try… Read More
Predict the output of the following program. class Test {     String str = "a";        void A()     {         try         {             str +="b";             B();         }         catch… Read More
class Test {     public static void main(String[] args)     {         try         {             int a[]= {1, 2, 3, 4};             for (int i = 1; i <= 4;… Read More
class Test {     public static void main (String[] args)     {         try         {             int a = 0;             System.out.println ("a = " + a);             int b =… Read More
class Base extends Exception {} class Derived extends Base  {}    public class Main {   public static void main(String args[]) {    // some other stuff… Read More
Output of following Java program? class Main {    public static void main(String args[]) {       int x = 0;       int y = 10;       int z =… Read More
class Test extends Exception { }     class Main {    public static void main(String args[]) {        try {          throw new Test();       }       catch(Test t) {… Read More
Predict the output of following Java program class Main {    public static void main(String args[]) {       try {          throw 10;       }       catch(int e) {          System.out.println("Got… Read More