Java Interview Questions and Answers
270 FOLLOWERS
This blog is Java interview questions and answers for helpfull to the job seeker,core java, j2ee, in core java , String, Collection, threading, Multithreading, OOPs Concept, JSP, Servlet, Struts , Spring and hibernate, Java interview questions and answers
Java Interview Questions and Answers
1M ago
In this post I am sharing important core java interview questions with answers for freshers.
1) Difference between c++ and java
2) What is mean by platform independent?
We can say java is a platform independent it means that you can compile java code in one platform(e.g windows machine) and run it in another platform(e.g linux) without changing the code.
3) Difference between jdk, jre and jvm.
Refer - difference between jdk, jre and jvm
4) What are access modifiers in java.
The Access Modifiers in java are Default, Public, Protec ..read more
Java Interview Questions and Answers
6M ago
In this post we will discuss how to return DTO's of non entity basis native query result from JPA repository method. JPA provides many implemented methods for database operation like findAll, findById and so on. If we use in-built JPA repository methods then corresponding entity to map with the query result.
In some of the scenario's need to use native query to join with multiple tables to get the required details. In such case, we should not have the entity mapping so need to d ..read more
Java Interview Questions and Answers
7M ago
As we discussed about Stereotype annotations in one of the blog post, the @Component annotation is a stereotype annotation in Spring. If you want to convert any java class as a Spring managed bean then to use component annotation. It will scan during the project start up and will create the bean if the component class exist in the component scan package.
@Bean annotation is used to create a bean, this can use along with Configuration annotation. Bean annotation is a method level annotation and name of the method serves a ..read more
Java Interview Questions and Answers
7M ago
In this post, we can discuss one of the important java interview questions i.e difference between equals() and == operator and sample examples.
The equals() method compares the content of two objects but == opeator checks the objects references of two objects for equality.
Let me see few examples to check both equals and == operator,
Created two string objects using new operator and applied equals and == operator to check the equality.
public class DemoClass {
public static void main(String[] args) {
String s1 = new String("A");
String s2 ..read more
Java Interview Questions and Answers
7M ago
In one of the previous post, listed all the java 8 stream coding questions and answers(blog post). Today's post we will discuss one of the important coding questions i.e to sort the list in ascending and descending order using java 8 stream api.
1) Sort the string of list object in ascending order using java 8 stream
import java.util.Arrays;
import java.util.List;
public class SortExample {
public static void main(String[] args) {
List<String> listOfStrings = Arrays.asList("A", "E", "B", "C");
listOfStrings.stream().sorted().forEach ..read more
Java Interview Questions and Answers
8M ago
In this post, we will learn the difference between Resource, Autowired and Inject annotation. All these annotations are used to inject the bean dependencies. Resource and Inject annotations are defined in Java and Autowired annotation defined in Spring framework.
@Resource – It's defined in the javax.annotation package and it's part of java.
@Inject – It's defined in the javax.inject package and it's part of Java
@Autowired – It's defined in the package org.springframework.bean.factory and part of Spring framework.
Internally ..read more
Java Interview Questions and Answers
8M ago
Below are the list of java technical lead interview questions asked in Akkodis during the firstround.
1) What are the features in java8 ?
2) Why introduced default method in java 8 ?
3) What is the use of static method in java 8 ?
4) What is functional interface in java8 ?
5) What is the use of flatMap in streams and explain with example
6) List<Integer> list = Arrays.asList(10, 23, 8, null);
Write a program to sort the list in ascending and descending order and remove the nulls --using streams
7) what is generics in java ? Is this supports po ..read more
Java Interview Questions and Answers
8M ago
In this post, we need to have a look one of the important coding interview questions asked for java 8 streams. Given list contains either String or Integers. Refer all coding questions here
1) Print duplicate elements using frequency and toSet methods .
In the below code used Collections.frequency to filter the data with occurance value greater than 1 and toSet method used to remove the duplicated in output.
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.st ..read more
Java Interview Questions and Answers
8M ago
Below are the list of java technical lead interview questions asked in LTIMindtree during the first round
1) Explain Saga design pattern used in Microservice(Answer)
2) What is orchestrator in Saga pattern?(Answer)
3) Which authentication mechanism used in project and how to implemented(AOuth2 with bearer token)?
3) What is the use of Eureka server?(Answer)
4) What is Functional interface in java 8? do we have default method in Functional interface(Answer)
5) Why introduced deafult method in interface in java 8?(Answer)
6) What is lambda expression ?(Answer)
7) What ..read more
Java Interview Questions and Answers
8M ago
In java8 introduced new class called Optional, using optional we can handle NullPointerException without using any null check condition.( Refer - Java 8 features) It provided many methods and using those it will be helpful to write cleanable code.
Using optional if variable value is null then using orElse method we can have a null functionality code inside it.
Below are the methods available in Optional class,
The Optional.ofNullable() --- > method returns a Non-empty Optional if a value present in the gi ..read more