Let’s learn random class in java. random class java An instance of Random class is used to generate a stream of pseudorandom numbers. Instances of java.util.Random are not cryptographically secure. Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. random class…

Read More random class java

Let’s learn difference between abstract class and interface in java. Difference between abstract class and interface in java Here’s the difference between abstract class and interface. abstract class interface an abstract class can have protected, private etc. as access modifiers for class members. members of interface are public by default. abstract class can have static,…

Read More Difference between abstract class and interface in java

Let’s learn difference between class and interface in java. difference between class and interface in java Here’s the difference between class and interface. class interface “class” keyword is used to declare class. whereas “interface” keyword is used to declare an interface. multiple inheritance is not supported in a class whereas interface supports multiple inheritance. A…

Read More difference between class and interface in java

Let’s learn difference between hashmap and hashset in java. difference between hashmap and hashset in java HashSet HashMap HashSet stores only objects. HashMap stores elements in key and value pairs. That is each element has its corresponding key which is used for retrieval during iteration. insertion order is not preserved. objects inserted are based on…

Read More difference between hashmap and hashset in java

Let’s learn recursion in java. recursion in java recursion is a process where a method calls itself infinitely or endlessly. recursion program in java recursion makes a java code closely packed. Here’s an example on infinite recursive function. public class InfiniteRecursiveExample { static void print() { System.out.println(“helloworld”); print(); } public static void main(String[] args) {…

Read More recursion in java

Let’s learn how to remove duplicates from arraylist in java. How to remove duplicates from arraylist in java Here the task is to remove duplicates in Arraylist. In the below java program first get given ArrayList with duplicate integer values. Now print ArrayList with duplicate integer values on the console. Create another ArrayList ‘alNew’. Pass…

Read More How to remove duplicates from arraylist in java