Exception Hierarchy in Java

Whenever any unexpected event like if required Index is more than the array size happens, it results in the stopping of the program. The name of this condition is an “Exception”. There are many types of exceptions occurred in java, and there is a certain hierarchy followed by java. We will be exploring this hierarchy through this blog. “Throwable class” is the topmost class in the hierarchy. It is mainly divided into 2 types which are Exception class and Error

Read more

Solve Error Java Access Denied FileNotFoundException

In this blog I will be sharing the reasons due to which you are getting Access is denied i.e, File Not Found Exception, and will solve the error as well. So let’s start and solve this error in your system. This error occurs for various reasons, let’s discuss them one by one in detail. 1. Opening or Trying to Read a Folder/Directory It is not possible for the user to see the directory as we do normally and if you

Read more

Custom Iterator in Java with Example

Through this blog, I will be sharing how can we make a custom iterator in Java. Iterators can come in handy in many situations. An iterator is basically an object which can help us to go over a collection, it can serve as an alternative to foreach loop. So let’s explore more about custom iterators and their functionality. Custom Iterators are made when we take a class that is implementing iterator and then we override the functions. Majorly we override

Read more

Rounding in Java – Math.Round, Math.Floor, Math.Ceil

We have decimal values in java, but sometimes there is a need to round them. It is important to remember which function should be used according to the requirements. So In this blog, I will be sharing some ways to round off decimal values in java. Checking whether java rounds the value up or down by default.

Output:

Explanation: We are taking two values val1 and val2 from the user as inputs. Then we are dividing both of

Read more

Advantages of Hibernate Over JDBC?

Hibernate is a framework used in Java to ease the development of applications to interact with databases. On the other hand, JDBC is an API to connect and execute queries with database in Java. In this blog, we will be talking about the main advantages of hibernate over JDBC. Let’s discuss each of them one by one in detail. 1. Database Dependency The Hibernate is not dependent on the database whereas in the case of JDBC the queries that need

Read more

Method Overloading in Java With Example

Method overloading states that we can have methods with the same name but something in their parameters should be different. If you know about constructor overloading then it is pretty similar to method overloading. Method overloading helps us from writing the same methods under different names. For example, a method involving multiplication of 2 numbers can be named as mymultiplication(int x, int y) and the method involving multiplication of 3 numbers can have the same name with different parameters as

Read more

Types of Constants in Java

Whenever we declare a constant in java its value tends to be the same throughout the entire program. In the case of a normal variable, we can change the assigned value. Java doesn’t allow the use of constants directly so we use static and final non-access modifiers. The main motive of using constants is to decrease repeatability in the code with some standard values. It is cached by the Java Virtual Machine and written code results in improvement of the

Read more

Java Collection Hierarchy

The collection is a framework in java. It contains some of the most used classes which are present in the interfaces. Collection interface mainly has 3 child interfaces and these are as follows. Image Source 1. List It contains an order of all the objects. This interface also helps you to have a dynamic size of arrays according to the number of objects present. It is implemented by Vector, Stack, ArrayList, and LinkedList. Therefore we can create a list object

Read more
1 2