Java Interview Questions
Java Interview Questions
-----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
---------------------------------------
-------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
int [] i={4,5,6,7,1,2,3};
10-10
1010-1010
Does not compile
Run-time error
_______________________________________________________________________________-
class Parent {
public void Print()
{
System.out.println("Parent");
}
}
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);
}
}
__________________________________________________________
____________________________________________________________________________________
____
8
9
Compilation error
Runtime error
____________________________________________________________________________________
__________
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);
}
CodeA CodeB A B
CodeA CodeA B B
CodeA CodeB B B
CodeB CodeB B B
__________________________________________________________________________________