Let’s learn functional interface in java. Functional interface in java Functional interface is one kind of an interface which has only one abstract method. Syntax: @FunctionalInterface interface interfacename { // one abstract method } NOTE: @FunctionalInterface is an annotation. This annotation is optional. Before Java 8 an interface had abstract method signature but didn’t define…

Read More Functional interface in java

Let’s learn instanceof java. instanceof java instanceof operator is used to check whether the object is an instance of specified type. Type can be a class or a subclass or an interface. instanceof operator returns either true or false. It is also known as comparison operator. Let’s see instanceof java example. public class Example {…

Read More instanceof java

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