Featured Posts

[Travel][feat1]

All About Class RuntimeException in Java

September 18, 2018

RuntimeException is the super class of all Exceptions which can be thrown during the normal operation of the java virtual machine.A method is required to declare in its throws clause.Any subclasses of the RuntimeException that might be thrown during th eexecution of the method but not caught.
In  simple words it is the base class for all exceptions that indicate some kind of programming issue or a bug. They originated as our or client programming using our library improperly. Because the indicate bugs,we virtually never catch a RuntimeException. It occurs during run time and automatically.In our own package we may throw some of the RuntimeExceptions.
The structure of the RuntimeException class is given as :

public class java.lang.RuntimeException extends java.lang.Exception{
//constructor
public RuntimeException();
//constructs an empty RuntimeException object that is an object with no message specified.
public RuntimeException(String message);
//constructs an RuntimeException object with the message specified.

}
 
All About Class RuntimeException in Java All About Class RuntimeException in Java Reviewed by Animesh Chatterjee on September 18, 2018 Rating: 5

All About Class NumberFormatException in Java

September 18, 2018


NumberFormatException is thrown from an application to indicate that the application has attempted to convert a String to one of the numeric types but the String does not have appropriate format.

The Structure of the NumberFormatException class is given below:


public class java.lang.NumberFormatException extends java.lang.IllegalArgumentException{
//constructor
public NumberFormatException();
//constructs an empty NumberFormatException object that is an object with no message specified.
public NumberFormatException(String message);
//constructs an NumberFormatException object with the message specified.

}
 
All About Class NumberFormatException in Java All About Class NumberFormatException in Java Reviewed by Animesh Chatterjee on September 18, 2018 Rating: 5

All About Class NullPointerException in Java

September 18, 2018


NullPointerException is thrown from an application when our code attempts to use null in the case where an object is required.
Below can be the scenarios where NullPointerException can occur:

  1. Calling the instance method of the/a null object.
  2. Accessing or modifying the field of the null object.
  3. Tracking the length of null as if it was empty.
  4. Accessing or modifying the slots of null as if it was an array.
  5. Throwing null as if there was a Throwable value
Applications should throw instances of this class to indicate other illegal uses of the null object.
The structure of NullPointerException class is given as :


public class java.lang.NullPointerException extends java.lang.RuntimeException{
//constructor
public NullPointerException();
//constructs an empty NullPointerException object that is an object with no message specified.
public NullPointerException(String message);
//constructs an NullPointerException object with the message specified.

}
 
All About Class NullPointerException in Java All About Class NullPointerException in Java Reviewed by Animesh Chatterjee on September 18, 2018 Rating: 5

All About NoSuchMethodException in Java

September 18, 2018


NoSuchMethodException is thrown to indicate that the object of a class does not have the method called.This exception is very rarely thrown as the existence of methods is primarily determined during compile time. We can get this exception if we remove a method from a class,recompile the class without dependency tracking and then run a program that calls the removed method.

The structure is given as :


public class java.lang.NoSuchMethodExceptionextends java.lang.Exception{
//constructor
public NoSuchMethodException();
//constructs an empty NoSuchMethodException object that is an object with no message specified.
public NoSuchMethodException(String message);
//constructs an NoSuchMethodException object with the message specified.

}
 
All About NoSuchMethodException in Java All About NoSuchMethodException in Java Reviewed by Animesh Chatterjee on September 18, 2018 Rating: 5

All About Class NegativeArraySizeException in Java

September 18, 2018


NegativeArraySizeException is thrown by an application when the code tries to create an array with negative size. The structure of the class NegativeArraySizeException  is given as :


public class java.lang.NegativeArraySizeException extends java.lang.RuntimeException{
//constructor
public NegativeArraySizeException();
//constructs an empty NegativeArraySizeException object that is an object with no message specified.
public NegativeArraySizeException(String message);
//constructs an NegativeArraySizeException object with the message specified.

}
 
All About Class NegativeArraySizeException in Java All About Class NegativeArraySizeException in Java Reviewed by Animesh Chatterjee on September 18, 2018 Rating: 5
Powered by Blogger.