Java Interview Questions | Glassdoor

Java Interview Questions

208

interview questions shared by candidates

Java Interview Questions

Sort: Relevance Popular Date

How would you count the number of words in a string consisting of uneven number of spaces between words( not dictionary words)? With and without library functions.

3 Answers

Write the function that calculates price of the cup of coffee where price of the condiments depends on size of the coffee cup. For example milk cost 10 c for small cup 15 c for medium and 20 c for large

4 Answers

What is the difference between Java and Java Enterprise Edition?

3 Answers

What is an immutable class?

2 Answers

implement sort(int a, int b, int c) in Java w/o using any Collections methods

2 Answers

5. The user of this class expected the output “Num: 1000000”. They got something else. What went wrong and how would you fix it? public class Test { public final static int NUMTHREADS = 1000; public final static int NUMLOOP = 1000; public static int num = 0; static class Mythread extends Thread { @Override public void run() { for (int i = 0; i < NUMLOOP; i++) { ++num; } } } public static void main(String argv[]) { Mythread threads[] = new Mythread[NUMTHREADS]; for (int i = 0; i < NUMTHREADS; ++i) { threads[i] = new Mythread(); threads[i].start(); } try { for (int i = 0; i < NUMTHREADS; ++i) { threads[i].join(); } } catch (InterruptedException e) { } System.out.println("Num: " + num); } }

2 Answers

Sample questions concerning Java or SQL.

2 Answers

The key thing was understanding how the java garbage collector worked.

2 Answers

how do you reverse a string?

2 Answers

How to find the median number out of 4 byte integers?

2 Answers
1120 of 208 Interview Questions