Java Senior Interview Questions

6,031 java senior interview questions shared by candidates

1)Which Java Version worked upon? Java 8 features? Stream API? 2)Why should the sub class exceptions be used before super class exceptions in a catch block? try{ //something } catch(RuntimeException|NullPointerException|IOException e){ } will the above code work? No it is going to be an error, but why is it happening? 3)Abstract class and Interface can have methods declared and defined. So when to use abstract class, when to use interface? 4)Hashmap internal implementation? 5)We have a map to store String and Integer key-value pairs as shown below. How to store data case-insensitive? Map<String,Integer>map=new HashMap<>(); map.put("abc",10000); map.put("ABC",10000); Above mentioned map should only store one key-value pair. 6)Design patterns? 7)How to create a singleton class? How to use it in Main class? 8)Chess boards question(two 8*8 array) on how a king at a certain position can be attacked by queens? How many possible queens can attack?
avatar

Senior Java Developer

Interviewed at Bounteous x Accolite

3.4
Jul 17, 2021

1)Which Java Version worked upon? Java 8 features? Stream API? 2)Why should the sub class exceptions be used before super class exceptions in a catch block? try{ //something } catch(RuntimeException|NullPointerException|IOException e){ } will the above code work? No it is going to be an error, but why is it happening? 3)Abstract class and Interface can have methods declared and defined. So when to use abstract class, when to use interface? 4)Hashmap internal implementation? 5)We have a map to store String and Integer key-value pairs as shown below. How to store data case-insensitive? Map<String,Integer>map=new HashMap<>(); map.put("abc",10000); map.put("ABC",10000); Above mentioned map should only store one key-value pair. 6)Design patterns? 7)How to create a singleton class? How to use it in Main class? 8)Chess boards question(two 8*8 array) on how a king at a certain position can be attacked by queens? How many possible queens can attack?

Jack and Jill were going through a jungle to the city. They encountered a monster who told them they will only be allowed to escape when they solve a puzzle for him. They didn’t have a choice so they agreed. He states the problem like : I have n buckets having 0 fruits in each bucket initially. I will give you n numbers denoting fruits required at nth position But you need to keep two simple rules: Either you can increment fruit count by 1 in each bucket i.e. Incremental Operation Or you can double the fruits in each bucket i.e. Doubling operation. Twist is - you cant decrease the bucket value either by subtraction or by dividing , only you can increment
avatar

Senior Java Developer

Interviewed at Bounteous x Accolite

3.4
Oct 30, 2022

Jack and Jill were going through a jungle to the city. They encountered a monster who told them they will only be allowed to escape when they solve a puzzle for him. They didn’t have a choice so they agreed. He states the problem like : I have n buckets having 0 fruits in each bucket initially. I will give you n numbers denoting fruits required at nth position But you need to keep two simple rules: Either you can increment fruit count by 1 in each bucket i.e. Incremental Operation Or you can double the fruits in each bucket i.e. Doubling operation. Twist is - you cant decrease the bucket value either by subtraction or by dividing , only you can increment

Viewing 3791 - 3800 interview questions

Glassdoor has 6,031 interview questions and reports from Java senior interviews. Prepare for your interview. Get hired. Love your job.