Microservices

What Are Microservices? Microservices are a form of service-oriented architecture style (one of the most important skills for Java developers) wherein applications are built as a collection of different smaller services rather than one whole app. Instead of a monolithic app, you have several independent applications that can run on…

Continue reading

Default Method

Need for default method- Without effecting implementation classes if we want to add new method to the interface then we can do this with default interface. Syntax:

Output: Default Method Suppose if we want to provide new implementation then we can do this as well. This can be done as…

Continue reading

Lamda_SquareExample

Lamda Expression example for square of int :

Output: Square of 2 is :4 now suppose we put parenthesis in the body as below and try to compile the code using command prompt,

you will get compilation error as below: \basic>javac Lamda_SquareExample.java Lamda_SquareExample.java:13: error: not a statement Interfun…

Continue reading

Lamda_AddExample

Example of Lamda Expression for addition of two int.

Output: Sum is:30 Sum is:300 Similar posts: Java 8 Features Functional Interface Lamda Expression

Continue reading

Lamda Expression

Lamda Expression: Ealier for a function few things were mandatory,such as 1>Access Modifier. 2>Return statement. 3>Name Eg:

  But for a Lamda expression these things are not required,so the above function is written as:

  The Operator that is used to denote the lamda expression is -> Now…

Continue reading

Functional Interface

An Interface which has only one abstract method is known as Functional Interface. It can have any number of default and static method but only one abstract method is allowed. @FunctionalInterface is the annotation used to forcefully tell the compiler that the interface is a FunctionalInterface. Sample code: package com.technicalstack.basic;…

Continue reading

Java 8 Features

Some of the important Java 8 features are; Functional Interfaces and Lambda Expressions default and static methods in Interfaces forEach() method in Iterable interface Java Stream API for Bulk Data Operations on Collections Java Time API Collection API improvements Concurrency API improvements Java IO improvements Similar posts: Top Java Questions…

Continue reading

Multithreading Interview Question-1

Question 1. What is Thread in java? Answer. Threads consumes CPU in best possible manner, hence enables multi processing. Multi threading reduces idle time of CPU which improves performance of application. Thread are light weight process. A thread class belongs to java.lang package. We can create multiple threads in java,…

Continue reading

Serialization and Deserialization in java

Serialization is a process of converting object into a sequences of byte which can be written to disk or database or sent over network to any other running JVM. The reverse process of creating object from sequences of byte is called Deserialization. A class must implement the Serializable interface present…

Continue reading

Collection Interview Questions

How can we make Hashmap synchronized? HashMap can be synchronized by Map m = Collections.synchronizedMap(hashMap); Question 13 : What are IdentityHashMap and WeakHashMap? IdentityHashMap : IdentityHashMap is similar to HashMap except that it uses reference equality when comparing elements. IdentityHashMap class is not a widely used Map implementation. While this…

Continue reading