I am a front-end developer and a technical writer. I try to share my knowledge of programming through the blogs. You can connect me through LinkedIn.

Why Java Does Not Support Destructor?

In any programming language, whenever we declare and create an object it takes some bytes of memory in the heap memory. After the usage of the objects, we need to delete them from heap memory as they might be responsible for taking some unwanted space. Let’s assume we forget to remove them and you are not able to write your program completely. This will suggest that our heap memory is exhausted completely. So destructors are used to free memory by

Read more

Solve “Requested array size exceeds VM limit” Error in Java

There is a limit on the declaration of maximum array size in java. So whenever we face the OutOfMemoryError i.e, Requested array size exceeds VM limit it means that the program is trying to allocate a particular size to an array that is larger than the size supported by the virtual machine. Cause of Error The value of maximum positive integer in java is 2^31 – 1 = 2,147,483,647. Now it depends on the specifications of the different operating systems

Read more

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
1 2