Java Programmer Interview Questions

26,887 java programmer interview questions shared by candidates

Given an array, print the Next Greater Element (NGE) for every element. // // The Next greater Element for an element x is the first greater element on the right side of x in the array. // Elements for which no greater element exist, consider the next greater element as -1. // // Example: // // Input: arr[] = [ 4 , 5 , 2 , 25 ] // Output: 4 –> 5 // 5 –> 25 // 2 –> 25 // 25 –> -1 // Explanation: except 25 every element has an element greater than them present on the right side // // Input: arr[] = [ 13 , 7, 6 , 12 ] // Output: 13 –> -1 // 7 –> 12 // 6 –> 12 // 12 –> -1 // Explanation: 13 and 12 don’t have any element greater than them present on the right side
avatar

Software Engineer - Java Developer

Interviewed at Synergy Business Solutions

3.6
Jan 26, 2024

Given an array, print the Next Greater Element (NGE) for every element. // // The Next greater Element for an element x is the first greater element on the right side of x in the array. // Elements for which no greater element exist, consider the next greater element as -1. // // Example: // // Input: arr[] = [ 4 , 5 , 2 , 25 ] // Output: 4 –> 5 // 5 –> 25 // 2 –> 25 // 25 –> -1 // Explanation: except 25 every element has an element greater than them present on the right side // // Input: arr[] = [ 13 , 7, 6 , 12 ] // Output: 13 –> -1 // 7 –> 12 // 6 –> 12 // 12 –> -1 // Explanation: 13 and 12 don’t have any element greater than them present on the right side

The questions ranged from core java to advanced java. They asked more questions related to core. Collections, threading, exception handling, architecture, etc. were their favourite topics. They also provided scenarios where I was asked to provide solutions. Scenarios related to what if there is a bug in this part of the section, how to do validation for a particular content, etc.
avatar

Java Developer

Interviewed at OpenXcell Technolabs

3.3
Feb 16, 2019

The questions ranged from core java to advanced java. They asked more questions related to core. Collections, threading, exception handling, architecture, etc. were their favourite topics. They also provided scenarios where I was asked to provide solutions. Scenarios related to what if there is a bug in this part of the section, how to do validation for a particular content, etc.

Viewing 721 - 730 interview questions

Glassdoor has 26,887 interview questions and reports from Java programmer interviews. Prepare for your interview. Get hired. Love your job.