Java Senior Interview Questions

6,013 java senior interview questions shared by candidates

It consisted of a telephonic, basic of java : overriding, overloading rules, design patterns, sort may on key and values. Java 8 Date Time API, streams, lambda expressions. Then a face to face with the Technical Manager : we had a general discussion about the job role. He asked me some questions on Executor framework, why we have it. Spring scenario oabout what if a singeltion scope bean uses a prototype scope bean. The was a design assignment given to solve in office : Design a Library. It has user stories and each user story had new functionality. Was not too tough. Adding members(name,phone number), taking care of duplicate members, book (name, isbn number, type). Then to make add member function thread safe.
avatar

Senior Associate - Java

Interviewed at BNP Paribas

3.8
Aug 11, 2019

It consisted of a telephonic, basic of java : overriding, overloading rules, design patterns, sort may on key and values. Java 8 Date Time API, streams, lambda expressions. Then a face to face with the Technical Manager : we had a general discussion about the job role. He asked me some questions on Executor framework, why we have it. Spring scenario oabout what if a singeltion scope bean uses a prototype scope bean. The was a design assignment given to solve in office : Design a Library. It has user stories and each user story had new functionality. Was not too tough. Adding members(name,phone number), taking care of duplicate members, book (name, isbn number, type). Then to make add member function thread safe.

You are given an array of words (strings) and an integer k k k. Your task is to write a function that returns the k k k longest words from the array. If there are fewer than k k k words in the array, return all the words sorted by length in descending order. If there are ties in length, return the words in alphabetical order. Input: An array of strings words[] where each string consists of lowercase and uppercase letters only. An integer k k k (1 ≤ k k k ≤ 100). Output: An array of the k k k longest words, sorted by length (and alphabetically if lengths are equal). Example: plaintextInput: words = ["apple", "banana", "kiwi", "grape", "watermelon"], k = 3 Output: ["watermelon", "banana", "apple"] Input: words = ["cat", "bat", "rat"], k = 5 Output: ["bat", "cat", "rat"] Constraints: The output array should not exceed k k k elements. You may assume that the input will always have at least one word.
avatar

Senior Java Developer

Interviewed at Apple

4.1
Apr 18, 2025

You are given an array of words (strings) and an integer k k k. Your task is to write a function that returns the k k k longest words from the array. If there are fewer than k k k words in the array, return all the words sorted by length in descending order. If there are ties in length, return the words in alphabetical order. Input: An array of strings words[] where each string consists of lowercase and uppercase letters only. An integer k k k (1 ≤ k k k ≤ 100). Output: An array of the k k k longest words, sorted by length (and alphabetically if lengths are equal). Example: plaintextInput: words = ["apple", "banana", "kiwi", "grape", "watermelon"], k = 3 Output: ["watermelon", "banana", "apple"] Input: words = ["cat", "bat", "rat"], k = 5 Output: ["bat", "cat", "rat"] Constraints: The output array should not exceed k k k elements. You may assume that the input will always have at least one word.

One example: in the same class you have methods with the same names, both with one parameter, first is taking Object and second is taking String. You call the method with null parameter, which method will be called and why? (Would you write a code like this in a real project?)
avatar

Senior Java Developer

Interviewed at Mphasis

3.4
Jun 11, 2020

One example: in the same class you have methods with the same names, both with one parameter, first is taking Object and second is taking String. You call the method with null parameter, which method will be called and why? (Would you write a code like this in a real project?)

Viewing 431 - 440 interview questions

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