Home » Java Basics

Java Basics

Java Custom Exception Example

java-logo

In this example we will look briefly at the basics of Exception, in Java Programming Language. We will also see, how to create a custom Exception Class. 1. Basics of Exception As per oracle docs, An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program’s instructions. In laymen terms, when ...

Read More »

Generic Method Example in Java

java-logo

In this example, we will be studying about generic methods and how to use the same in our programmes. Generic method, as the name suggests, is a method that does not specify the Type of its parameters, per se. Rather, it defines a criteria (or a place holder) by which, the method introduces its own type parameters. We will try ...

Read More »

java.lang.SecurityException – How to solve SecurityException

java-logo

In this tutorial we will discuss about SecurityException in Java. This exception is thrown by the security manager, in order to indicate a security violation. The SecurityException class extends the RuntimeException class and thus, belongs to those exceptions that can be thrown during the operation of the Java Virtual Machine (JVM). It is an unchecked exception and thus, it does ...

Read More »

java.util.InputMismatchException – How to solve InputMismatchException

java-logo

In this tutorial we will discuss about the InputMismatchException in Java. This exception is thrown by an instance of the Scanner class to indicate that a retrieved token does not match the pattern for the expected type, or that the retrieved token is out of range. The InputMismatchException class extends the NoSuchElementException class, which is used to indicate that the ...

Read More »

java.lang.NoSuchFieldError – How to solve SuchFieldError

java-logo

In this tutorial we will discuss about the NoSuchFieldError in Java. This exception is thrown to indicate that an application tries to access or modify an object’s field, but that field no longer exists. This error can only occur during runtime, if the definition of a class has incompatibly changed. The NoSuchFieldError extends the IncompatibleClassChangeError class, which is used to ...

Read More »

java.lang.ArrayStoreException Example

java-logo

In this example we will discuss about ArrayStoreException. This exception is thrown when there has been made an attempt to store the wrong type of object into an array of objects. The ArrayStoreException extends RuntimeException, which means that it is an exception thrown at the runtime, so the try-catch block for this exception is not required. ArrayStoreException exists since JDK1.0. ...

Read More »

java.lang.StringIndexOutOfBoundsException – How to solve StringIndexOutOfBoundsException

java-logo

In this tutorial we will discuss about the java.lang.StringIndexOutOfBoundsException in Java. This exception is thrown by the methods of the String class, in order to indicate that an index is either negative, or greater than the size of the string itself. Moreover, some methods of the String class thrown this exception, when the specified index is equal to the size ...

Read More »

java.lang.IllegalAccessError – How to resolve Illegal Access Error

java-logo

In this example we will discuss about IllegalAccessError. This is thrown if an application attempts to access or modify a field, or to call a method that it does not have access to. The definition of some class, on which the currently executing method depends, has since changed. It is normally thrown when modifying a final property of the base ...

Read More »

java.lang.VerifyError – How to solve VerifyError

java-logo

In this tutorial we will discuss about the VerifyError in Java. This error indicates that the verifier, included in the Java Virtual Machine (JVM), detected a class file that despite well formed, it contains some type of internal inconsistency or faces a security problem. The VerifyError class extends the LinkageError class, which is used to indicate those error cases, where ...

Read More »

java.lang.IncompatibleClassChangeError – How to resolve Incompatible Class Change Error

java-logo

In this example we will discuss about IncompatibleClassChangeError. This is thrown when an incompatible class change has occurred to some class definition. The definition of some class, on which the currently executing method depends, has since changed. It is normally thrown when a non-final field of a base class becomes static, or when the base class turns into an interface ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close