Exception
- 18 September
[Fixed] IllegalArgumentException: Bound must be positive
In this post, we will see how to fix IllegalArgumentException: Bound must be positive in java. You will generally get this exception while generating random numbers using Random.nextInt() method. If you pass bound as 0 or less than 0, then you will get the exception. Let’s understand with the help of example: [crayon-6729b1374efb1262400635/] When you […]
- 06 April
[Solved] Exception in thread “main” java.lang.NullPointerException
In this tutorial, we will see the most frequent java exception i.e. Exception in thread main java.lang.NullPointerException. It is one of the Runtime Exception. Raise your hand if you ever got NullPointerException while working on java code. I am sure that this is the exception you might have encountered most frequently. You might also agree […]
- 22 December
java.util.NoSuchElementException
java.util.NoSuchElementException is a RuntimeException or say an UncheckedException and therefore it does not need to be declared in a constructor’s or a method’s throw block. java.util.NoSuchElementException is usually thrown when we try to access some element which is not present or reserved for the underlying data structure in the heap, and, thrown by the different […]
- 21 December
java.lang.StackOverflowError
In this article, we will discuss about the java.lang.StackOverflowError by looking different code examples and also how can we avoid them. More precisely, StackOverflowError is an error which Java doesn’t allow to catch, for instance ,stack running out of space, as it’s one of the most common runtime errors one can encounter, because it’s raising […]
- 05 October
java.lang.NumberFormatException
In this post, we will see about Java.lang.NumberFormatException. java.lang.NumberFormatException occurs where you try to convert any non-numeric String to Number such as Integer, Double, Float or Long. This exception generally occurs when you get input from user in the form of String. This is not Java developer‘s fault and mostly data error. In this scenario, […]
- 09 May
FileNotFoundException in Java
In this post, we will see about FileNotFoundException in java. FileNotFoundException is thrown by constructors of FileInputStream, FileOutputStream, RandomAccessFile when file is not found on specified path. Exception can also be raised when file is inaccessible for some reason.For example: When you do not have proper permissions to read the files. FileNotFoundException is checked exception […]