Harshit Rathore

Object Class in Java – java.lang package

After java.util package, java.lang package is another java package that is used most by the programmers. This package is by default imported in the java program, therefore it is not required to import it explicitly. Some of the most commonly used class in this package are: Object String StringBuilder StringBuffer Wrapper Classes Now discussing these …

Object Class in Java – java.lang package Read More »

Customized Exceptions and Types of Error in Java

Customized Exceptions Sometimes during creating a program, there is a requirement of some special exception which is not available. So in such situation Java gives us the facility to create our own exceptions called as customized exceptions. Consider the following example of a customized_exception, import java.util.Scanner; class TooYoungException extends RuntimeException { TooYoungException(String str) { super(str); } …

Customized Exceptions and Types of Error in Java Read More »

Different types of Exception in Java

Top Exceptions in Java On the basis of source which triggers the exception, we divide exceptions into 2 types as: 1) JVM Exceptions: Exceptions which arrise automatically by the JVM whenever a particular event occurs are called JVM exceptions. For example: a) ArrayIndexOutOfBoundsException: It is the child class of RuntimeException and hence it is uncheck. It …

Different types of Exception in Java Read More »