Author: Arpit Mandliya
- 04 November
Topological Sort in java
In this post, we will see about Topological Sorting in the graph. Topological Sorting is ordering of vertices or nodes such if there is an edge between (u,v) then u should come before v in topological sorting. Topological sort is possible only for Directed Acyclic Graph(DAG). If there is a cycle in graph, then there […]
- 04 November
How to create list of lists in java
In this posts, we will see how to create a list of lists in java. You can easily create a list of lists using below syntax List<ArrayList<String>> listOfLists = new ArrayList<ArrayList<String>>(); or ArrayList<ArrayList<String>> listOfLists = new ArrayList<ArrayList<String>>(); One of the Usecase This is generally useful when you are trying to read a CSV file and […]
- 04 November
Can we overload main method in java
In this post, we will see about "Can we overload main method in java".This is one of the most asked Core java interview questions. Yes, we can overload main method in java but when you run your program, JVM will search for public static void main(String[] args) and execute that method. Overload main method in […]
- 02 November
Dynamic method dispatch in java
In this post, we will about Dynamic method dispatch which is also referred as run time polymorphism. Dynamic Method Dispatch Dynamic method dispatch is a technique by which call to a overridden method is resolved at runtime, rather than compile time.When an overridden method is called by a reference, then which version of overridden method […]
- 01 November
Java DecimalFormat example
In this post, we will see how to format a number using DecimalFormat in java. DecimalFormat DecimalFormat class is subclass of NumberFormat class and it is used to format numbers by using specify formatting pattern.We can format a number upto 2 decimal place,upto 3 decimal place, using comma to separate digits. Creating DecimalFormat object [crayon-68c2fad52b01f442345086/] […]
- 29 October
Can we override static method in java
No, we can not override static method in java. Static methods are those which can be called without creating object of class,they are class level methods. On other hand,If subclass is having same method signature as base class then it is known as method overriding. Its execution decided at run time. Below are the reasons why […]
- 28 October
How to take input from user in java
In this post, we will see how to take input from user in java. There are times when you want to take input from user and run program according to user input. There are many ways to take input from user and some of them are: Using Scanner Using BufferReader Using  Scanner class Scanner class […]
- 28 October
Could not reserve enough space for 2097152kb object heap
In this post, we will see an error(Could not reserve enough space for 2097152kb object heap object heap) which you might have encountered while dealing with JVM.We will see how can we fix this issue. error occurred during initialization of vm could not reserve enough space for 2097152kb object heap is generally raised when Java […]
- 28 October
Error could not create the Java virtual machine in java
In this post, we will about an error: Could not create the Java virtual machine in java. You can provide VM arguments to provide heap size for Java virtual machine. You can specify VM argument -Xms and -Xmx in form of KB, MB or GB. For example: Let’s say you want to specify maximum heap […]