0% found this document useful (0 votes)
6 views

Java Interview Questions

The document consists of a comprehensive list of interview questions covering various topics in Java, including project-related inquiries, Java concepts, OOP principles, multithreading, collections, Spring framework, microservices, and database operations. It also includes programming tasks and code snippets for candidates to analyze and explain. The questions are designed to assess the candidate's technical knowledge and practical skills in Java development.

Uploaded by

Vamsi Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Java Interview Questions

The document consists of a comprehensive list of interview questions covering various topics in Java, including project-related inquiries, Java concepts, OOP principles, multithreading, collections, Spring framework, microservices, and database operations. It also includes programming tasks and code snippets for candidates to analyze and explain. The questions are designed to assess the candidate's technical knowledge and practical skills in Java development.

Uploaded by

Vamsi Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Interview Question

------about Project ------


1)Briefing your Project//tell me about ur project
2)which type of problem you faced?
// what are the difficulties u have faced in ur project ?(rep)
3)Is there any multithreding
you used in your project?
4)Java exception which major exception you faced?
5)which type of problem you faced?
6)have you used rest api ?
7)which authontications you used?
8)Which exception you handel in project?
9)Tell about critiacl business logic you devloped?
10)Have you used Microsevices ? how many microservices you created?
11)Who is your Client?
12)What is your roles in your Project?
13)Microservices uses?
14)are you working on Spring mvc or Boot ?(yes both)
15) tell me how to you use both?
16)Project architechure
17)If you are using spring then have you used a JSP in project?
18)what is you front end langauge
19)If you are usng JSp but Spring boot return APi
20)if you are using spring boot the how you can use
21)there is any Encapsution in Your Project tell me about this
22)which opration perform In Spring boot
23)OOPS concept with Example in Used in your Project?
24)where you used Overriding and overloading in project?
25)Is there any multithreding you used in your project?
26)what is recent work u have done in ur company?
//why this problems occur
27)what are the other concerns that u have?
28)how inheritance is applied in ur project .(rep)
29)what is flow of ur project ?
30)which security is use in your project
31)which technology is used in your project
32)which version of java you have work on
33)in your project which @annotation are used , write structure, flow of project
34)how to do u use JSON?
35)Why do you not use interface instead of abstract class?
36)what is the module of your project?
37)have you write repository in project?
38) Any proud moment you feel as a java devloper
39) How to user Collection in your project?
40) write a flow from DTO to controller
41) About Rest API
42) what is major issue faced during project?
43) basic information abouit system like (Ram, Core, procssor, thereads)
44) how to migarate data one DB to Another DB using Spring boot (how multithreading you used in this)
45) in banking domain trhere are 15 accoubnt so some of them are reapted and some are unique how we
find the unique ?
-------java------------
1.what is static variable ? can we modify static variable .(rep)
2.what is the diff between static and final variable.
3.can we declare a constructor as a final.
4.what is the difference between input and output
5.recurssion function in java?
6.what is shift operator?
7.what is pacakge?
8.SOLID Principle
9.load balancing in java
10.what is entry function in springboot and in java
11.what is the difference between core java and advance java
12.class loader in java?
14. how to comapre Object?
15. whay soime method provided in object class?

------OOPs (Core Java)----


1)Java inheritance?
2)OOps Concept?(Repetated)
3)Interface in java?
4)what is Interface and how to create a object of interface?
5)Difference between Abstract class and interface?
what is abstract classs
6)If you are saying you can achieve multiple inheritance then explain how ?
7)give me the realtime example of polymorphism?
8)how to access interface method in java
9)why we use interface over abstraction
10)how to use ooops conceopt in project?
11) interface is prefable in java?
12) what is default access modifer for method?
13) soppose we have a pricvate varibale ijn class how can we get that privatye vvariable in other class?

-----keyword----
1)synchronization with example
2)Volaile
3)transient
4)synchronouns
5)asynchronouns
6)this and super keyword
7)JVM and JRE and JDK(rep)

-------string-----------
1)how many ways create string.
2)String Immutability? string concat?(rep)
3)Stringbuffer and string builder?(rep) when you use?

------Exception--------
1)when we get indexoutofbounce and nullpointerexception
2)try catch and try with resource
3)What is Exception ?
4)How you handle the Exception?
5)hereirchy of eception?
6)Parent of exception?
7) iffrence between error and exception?
8)

----- multithreading--------
1)suppose if u want to schedule any task what will u do. que regarding to multithreading .
2)Ways to create thread
3)What is multithreading?
4)projection
Deadlock in java?
5)sleep() and wait()?
6)what is thread?
7)What is synchronized?
8)what is multithreading
9) diffrence between throe and throws?
10) start and run method?
11) wait , notify and notifyAll?
12) what is deadlock?
13) which is types locks?
14)suppose if u want to schedule any task what will u do. que regarding to multithreading ?

-------Collection-------
1)how to iterate over the map?
2)What is Arraylist and its method?
3)What is Map?
4)What is entry and Map.Entry ?
5)comparable and comparator(rep)
6)hashmap vs treemap
7)map vs flatmap --> flatmap programe
8)how to resolve hash collision?
9)@springBoot Application - there annotation in that
10)What is spring boot
11)how to avoid hashCollision.
12)How u can remove duplicates from list?
13)hashmap vs concurrent hashmap
14)concurrent hashmap implementation.
15)what is synchronzied map.
16)arraylist vs linkedlist(rep)
17)queue blocking queue
18)treeset
19)inertnal working hashmap(rep)
20)design a tree like strcuture book , book ahe tya book madhih categories ahe tree like strcuture
21)Difference Collection and Collectios?
22)create HashMap and use size method?
23)default size of HashMap and its loading factor?
24)what is bucket and node?
25)advantage of map
26)GC in java?
26.1)27) equal and hashcode method in java?
27) equal and hashcode contract?
28) what is hash colosion?
29)How t0 prevent them?
30)use of object class & its methods?
31) internal working of concurent Hash map?

-----Java8--------
1)What are the features Included in java 8?(Rep)
2)Date and Time API
3)optional class(rep)
4)what is map in java 8.
5)Runnable vs callable interface
6)stream.of() method -->
7)What is stream API?
8)Difference .Java7 and Java8
9)can we use functional interface in lambda
10)what is the new feature implanted in collection in java8 expect stream API?
11)What is intermidate and terminal opretion? And what are they?
12)What is Lazy Loading
13)method refrence and use of it
14)marker interface ?what is use of it?which are they?
15)DateandTime ? in java7 there is already Date feature is present then why there in updation in java8?
16)What is the in feature added in collection?
17)what is function.identity?
18)what is collection and streamAPI?
19) Internal woking of stream API?
20)advancwe fetures in collection?
21) java 11 fetures?
22) optional class in java 8?

-----Design Patter----
1)singleton design pattern
2)what is singleton class.
3)Static and singleton
4)What are the design pattern
5)MVC Design pattern
-----Spring Framework------
1)Spring api Authentication and authorization?
2)Architechure of MVC?
3)Spring boot Architechure
4)actuator
5)new features in springboot 3.1.
6)@transactional?
7)what are the restservices.
8)what is the difference between restful web services and normal web services .
9)diff between restcontroller and controller.
10)why we use json in restapi as return the response.
11)what is bean? bean scopes?
12)Difference between Spring and Spring boot?(rep)
13)SpringBoot annotation(rep)
14)HQL in Hibernate?
15)@Data,@controller@Bean(rep)
16)what is IOC?
17)what are DI?
18)why we prefer spring boot?
19)Expalin @component and @service
20)Version of spring boot-2.3
21)what are the HTTP methods ellaborate?
22)@requestparam and @requestvalue
23)@requestparam and @ pathvariable
24)Comprehensive framework for building Java applications
26)what is @autowired,@bean,IOC Container.(rep)
27)How to send image through postman
28)how to do u use JSON?
29)@transinet? and @Qualifier?(rep)
30)What is pathparam and queryparam?
31)put and patch difference(rep)
32)status code 200,201,202?
33)Restful Principle
34)what is JPA ?
35) status code Series
36)What is idempotent in HTTP?
37)Rest API method
38) diffrence patch and put
39)what is springActutor?
40)Spring profile?
41)spring @Primary and @qulifire?
42)@component scan in spring boot?
43)@Autoconfiguration internal working?
44) how work httpMethod internally and its flow?
45) can we do crud opration without using a Server|
46) how many types of server present in spring?
47)
-------Microservices-----
1)how microsevices communicate with each other?
2)Architechure of Microservices?what is microservices?(rep)
3)api gateway ?
4)load balancer?
5)monolithic vs microservices.
6)microservices disadvantages.
7) What is Ci/cd
8)what is AOP?
9)microservices e commerce applications examples multiple servers 100 user is coming but instantly
20000 are using but avoid server crash how it handled using Load balancing auto scaling database
level?
10)Difference between Monolithic and Microservices
11) what do you know about microservices
12) how to test services by using post man

---------------------------------------

1.have u worked on messaging queue like rabbitmq , apache kafka .


2.toArray why we use?
3.what is authentication?
4.what is authorization?
5.junit and mockito?
6.what is compatible?
7.what is time complexity?
8.what is Api gateway
9.what is load balancing?& it is relatable to database t spring?
10.sqs and sns?

-------program----
1)Duplicate array Question? (Using HashMap)
2)Encapsulation write a program
3)Singletone write a program
4) Dynamic Polymarohism and Static write in code
5)Reverse the words of String
6)Create list .add method()
7)do you have idea about sorting ? the....write a Bubble sorting Program
8)write a program to find second largest no. without using build in method and explain i
9)array program to add an element in an exixting array using java
10)third highest using stream api in java
11)Cube of int
12)int a[]={1,2,3,5,9,10,7,6} find the messing number in array by using java 8
13) find Thrid highet number form array
14) find The word in in round parathysys and reverse it xyz(cba)yesd
15)find the occurance in string?
16) there is text file which have multiple sentances and multiple words so we have to find occureanc eof
this word?

-------MySql-----
1)Joins
2)Difference between delete, drop , truncate
3)grouby and having clause
4)join vs union
3)procedure In database
4)InnerJoin Join Employee ON Order.(EmployeeID=EmployeeID)
5)sql query to find the sum of max score of student
6)what schema have you work
7)what is [procedure and Fucntion
8) DML opration
9) DDL opartion
10) why we use database?
11) what is primary key and unique and forign key
12)Rigt join and left joins and union join and unioun all
13) all types of join
14)write delete command
15)what is generate d primary key
16)which one you prefer in join
17) do you know about clauses?
18)what is grant?
19) write outter join?
20) grouping by calsue?
21|) what is indexes ? based on column?
22) what if forign key is allowed a null value?
23)

-------Git------
1)what if you want to get the updated code in your system?- git Pull
2)git conflict
3)how to creat git branch ?
4)when you have two interface having same default method what will happen? - conflit

---------------------------------------------------

cube of array

public class Test{

public static main (String[] args){

int [] i={4,5,6,7,1,2,3};

int [] cubeArry = Arryas.stream(i).map(n->n*n*n).toArray();


System.out.println(Arryas.toString(cubeArry));
}
}

------------------------------- Find the output of this code -----------------------------------------

What is the output of the following code snippet?


Integer int_data = new Integer(10);
System.out.print(int_data.byteValue());
System.out.print("-");
int int_data_2 = new Integer(10);
System.out.print(int_data_2.byteValue());

10-10
1010-1010
Does not compile
Run-time error

_______________________________________________________________________________-

What is the output of the following code snippet?

class Parent {
public void Print()
{
System.out.println("Parent");
}
}

class Child extends Parent {


public void Print()
{
System.out.println("Child");
}
}

class Main {
public static void PrintMain(Parent o)
{
o.Print();
}
public static void main(String[] args)
{
Parent x = new Parent();
Parent y = new Child();
Child z = new Child();
PrintMain(x);
PrintMain(y);
PrintMain(z);
}
}

Child, Child, Child


Parent, Child, Child
Parent, Child, Parent
Parent, Parent, Child

__________________________________________________________

What is the output of the following code snippet?


public class Code
{
public static void main(String args[])
{
StringBuffer str1 = new StringBuffer("open");
StringBuffer str2 = str1;
str1.append("genus");
System.out.println(str1 + " " + str2 + " " + (str1 == str2));
}
}

opengenus open false


opengenus opengenus false
opengenus open true
opengenus opengenus true

____________________________________________________________________________________
____

What is the output of the following code snippet?

class Code extends Thread


{
public void run()
{
System.out.print("thread 1");
}
public static void main(String args[])
{
Code thread1 = new Code();
thread1.start();
thread1.stop();
thread1.start();
}
}

8
9
Compilation error
Runtime error

____________________________________________________________________________________
__________

What is the output of the following code snippet?

class CodeA
{
public String type = "A ";
public CodeA() {
System.out.print("CodeA ");
}
}
public class CodeB extends CodeA
{
public CodeB() {
System.out.print("CodeB ");
}

void go()
{
type = "B ";
System.out.print(this.type + super.type);
}

public static void main(String[] args)


{
new CodeB().go();
}
}

CodeA CodeB A B
CodeA CodeA B B
CodeA CodeB B B
CodeB CodeB B B

__________________________________________________________________________________

You might also like