Photo of 133 Java interview questions from top tech companies

133 Java interview questions from top tech companies

Hi, I’m Brian, a former senior software engineer and now industry mentor at Pathrise. I have worked with hundreds of software engineers to help them land their dream jobs in tech.

Java is one of the earliest successful programming languages and it is still widely used today. Software engineers, especially full-stack, should have a good grasp on Java as it is one of the top programming languages for those roles. So, if you are preparing to interview on a team that uses Java, you should practice by working on the types of questions you will likely be asked.

We created a list of 133 Java interview questions from real tech companies for you to practice. We have also included some tips that we found to be helpful in our experience helping hundreds of software engineers land great jobs.

  1. Accenture question – Why is Java “platform independent”?
  2. LinkedIn question – What is a recursive function in Java?
  3. AMD question – How can you differentiate between C, C++, and Java?
  4. Pinterest question – What is runtime polymorphism?
  5. Apple question – How can you differentiate between method overloading and method overriding?
  6. ADP question – What is an interface in Java? Can we implement multiple interfaces in one class?
  7. Accenture question – Explain inheritance in Java? How can it be achieved?
  8. Microsoft question – Can we use multiple inheritance in Java? Explain why or why not.
  9. Google question – What can we do if we want to access a private member of a class?
  10. eBay question – What is the significance of the “static” keyword?
  11. LinkedIn question – What is “collection framework” in Java?
  12. Spotify question – What is the list interface in collections?
  13. Airbnb question – What do you understand about object cloning?
  14. Uber question – Can we insert duplicate values in a set?
  15. Accenture question – What is the “diamond problem” in Java? How can it be removed?
  16. Groupon question – What is the deadlock condition in multithreading?
  17. AMD question – Differentiate between collection and array.
  18. Airbnb question – What do you mean by “Java is a statically typed language”?
  19. Apple question – What is a lambda expression? Why is it used?
  20. Microsoft question – What is lazy initialization in hibernate?
  21. eBay question – Explain Flow of Spring MVC.
  22. Accenture question – What is the difference between a TreeMap and HashMap? What about between a HashMap and Hashtable?
  23. ADP question – Difference between public, private, default and protected?
  24. Google question – What is a final method?
  25. Pinterest question – What is casting?
  26. Groupon question – What is dependency injection or IOC (Inversion of Control)?
  27. Accenture question – What is a Final Variable?
  28. Groupon question – What is the use of the transient keyword?
  29. Airbnb question – What are various types of class loaders used by JVM?
  30. eBay question – What is an immutable class?
  31. Infosys question – How is polymorphism implemented in Java?
  32. Spotify question – What is the difference between stack and heap memory?
  33. AMD question – Write a program to check if a number is prime.
  34. Uber question – Explain the concept of inheritance.
  35. Infosys question – What is ‘null’ and how is memory allocation done for null objects?
  36. Google question – What is the difference between array and ArrayList?
  37. LinkedIn question – Write a program to swap two numbers in a list. Now write the same program without using a temporary variable. Is it possible?
  38. Apple question – What are the different modifiers in Java?
  39. Microsoft question – What is a class? How to create an object? If a class is static, can you create an object?
  40. ADP question – What are the different types of loops in Java?
  41. Infosys question – Why does a binary member function only accept a single argument?
  42. Groupon question – How can I get at the Dos File Handle associated with my Iostream?
  43. Amazon question – How do you merge two sorted linked lists?
  44. Google question – Write a program that checks if two strings are anagrams or not?
  45. Microsoft question – How do you find all pairs of elements in an integer array, whose sum is equal to a given number?
  46. Google question – Write a function to print nth number in fibonacci series.
  47. Pinterest question – Write a function to count a total number of set bits in a 32 bit Integer.
  48. Amazon question – Write an algorithm to check if a number is palindrome.
  49. Microsoft question – Write an algorithm to find out if array contains duplicates.
  50. eBay question – Write code to reverse a linked list. If you are able to do it using loops, try to solve with recursion.
  51. Amazon question – How do you rotate an array by a given pivot?
  52. Airbnb question – How do you remove duplicates from a sorted linked list?
  53. Microsoft question – How do you find the sum of digits of a number using recursion?
  54. Google question – Sort an array using selection sort.
  55. IBM question – What is the difference between abstract classes and interfaces?
  56. Google question – What is the difference between String, StringBuilder, and StringBuffer.
  57. AMD question – What is the difference between Final, Finally, and Finalize.
  58. Spotify question – What are custom exceptions?  
  59. IBM question – What are web services? What are APIs? How do you create a REST API?  
  60. LinkedIn question – What is the difference between object-oriented programming language and object-based programming language?  
  61. Accenture question – What is abstraction and encapsulation in Java?  
  62. Microsoft question – What is the life-cycle of a servlet?
  63. IBM question – What are threads?  
  64. Groupon question – What is the difference between set and list?
  65. Pinterest question – What is the difference between iterator and ListIterator?
  66. AMD question – Differentiate between synchronized block and synchronized method?
  67. Google question – How do you handle the runtime exception in jsp?
  68. IBM question – How can you differentiate between java.util.date and java.sql.date?
  69. Microsoft question – I have 1 to 100 elements in an array unordered, one element is missed, can you find that element?
  70. eBay question – How can you differentiate between equals() and hashcode()?
  71. ACI Worldwide question – What is the difference between get() and load() in hibernate?
  72. Adobe question – Why is String immutable in Java?
  73. 23andMe question – Explain the difference between checked and unchecked exceptions?
  74. Spotify question – How do you define a functional interface?
  75. Accenture question – When do you use a vector?
  76. Spotify question – What is OSGI?
  77. Adobe question – What is the difference between Route53 alias and cname?
  78. Microsoft question – There is a server which is 90% full, I need to increase the space. How can I do it?
  79. Adobe question – What’s the difference between Java and C++? What about Java and Python?
  80. ADP question – What is the difference between == and .equals()?
  81. Google question – If you are given a choice to use either ArrayList and LinkedList, which one would you use and why?
  82. Apple question – What are the design considerations while making a choice between using interface and abstract class?
  83. ADP question – What are some different logging levels for log4j?
  84. Microsoft question – What is a cloneable interface and what all methods does it contain?
  85. LinkedIn question – What are the benefits of using prepared statements? Does that benefit extend only if similar prepared statements are used within an application or it extends even with multiple applications having similar prepared statements?
  86. ADP question – Where is the prepared statement object created – in Java application or DB?
  87. eBay question – What are the types of executor interfaces?
  88. Google question – What are the core interfaces in hibernate?
  89. ADP question – If two interfaces have the same method, how would you handle that method in a class implementing these two interfaces?
  90. Microsoft question – Which type of EJB can use bean pooling?
  91. Pinterest question – How can you differentiate between include directive and include action in jsp?
  92. Accenture question – How can you differentiate between import and include directive in jsp.
  93. Uber question – How can you differentiate between == and === ?
  94. ADP question – Where would you configure database details in tomcat server?
  95. Airbnb question – Write a method to check if an input string is palindrome.
  96. Amazon question – What is the difference between composition and inheritance in Java?
  97. Google question – Describe, in general, how Java’s garbage collector works.
  98. Amazon question – Design an e-commerce application using AWS. What AWS services will you use? What is the difference between AWS CloudFormation and AWS AMI?
  99. Amazon question – What is the difference between region, availability zone, and edge locations?
  100. Amazon question – What is the difference between S3 and EFS?
  101. Microsoft question – How can we protect from accidental deletes in S3?
  102. Apple question – What kind of access policy should be kept on S3 buckets?
  103. eBay question – What is the relationship between VPC and subnet? Can you explain with an example?
  104. ADP question – What is the difference between single instance web environment and load balanced auto scaling?
  105. Amazon question – What are the problems one could face while working with serverless technologies like AWS Lambda? How does AWS Lambda handle failure during event processing?
  106. Amazon question – What does AMI include?
  107. LinkedIn question – Why is cloud infrastructure so powerful?
  108. Spotify question – What are the advantages of having edge locations?
  109. Accenture question – What does effect, action, and resource mean with respect to AWS IAM policy?
  110. Uber question – How can we restrict CloudFront access to a particular geography?
  111. Amazon question – What is the use case for “on demand” EC2?
  112. Groupon question – What is the use case for “spot” in the EC2 plan?
  113. AMD question – What is the difference between overloading and overriding?
  114. Pinterest question – How do you find whether a given integer is odd or even without use of the modulus operator in Java?
  115. Google question – What is MVC?
  116. Apple question – What is reflection?
  117. Airbnb question – What is “fail fast” and “fail safe” in collections?
  118. Groupon question – Why doesn’t Java support multiple inheritance?
  119. AMD question – What is the use of HashCode in objects?
  120. Uber question – How are values passed in Java? By value or reference?
  121. ADP question – What is the purpose of commit and rollback in databases?
  122. Spotify question – What are exceptions and exception handling in Java?
  123. AMD question – What are the methods to connect to a database in Java?
  124. eBay question – Write a program to find the depth of a node binary tree.
  125. LinkedIn question – Talk about a time you utilized serialization in your project code?
  126. Google question – How do you analyze memory leaks in your Java application?
  127. Accenture question – Explain how a class is loaded?
  128. AMD question – What is the difference between map and filter methods in streams?
  129. Apple question – What is a deadlock?
  130. Pinterest question – What is the order of method invocation in an applet?
  131. Apple question – What is an applet? What is the lifecycle of an applet?
  132. eBay question – Develop a simple paint like program using applets.
  133. Avaya question – What are marker interfaces? Name a few Java marker interfaces.

At Pathrise, our industry mentors work with software engineers every day on their interview preparation and we see so many candidates who are ready technically, but they still struggle. We wanted to provide some extra tips to help you stay confident in your interviews.

  • Start with clarifying questions

Before diving right into code, start by thinking of questions that you can ask that will clarify the problem and make sure you are on the same page as the interviewer. Some examples of these questions: “Are repetitions allowed?” or “Do you want to return permutations or combinations?”

  • Tell the interviewer what you know

We always recommend that you provide short tidbits of knowledge to your interviewer as you go through the problem. This gives them a sense of what you know without having to ask you, which is what we call proactively showing positive signal. It also reduces awkward silences, especially in times when you are thinking and not coding.

  • Make context statements as you work

While you work through the problem, clue the interviewer in to your thought process and decision-making. This gives them more insight into what you are doing and why. It is especially beneficial for them to have this window into your choices in case you make a mistake.

  • Ask for help, not hints

It is ok to get help from the interviewer, though a lot of them won’t appreciate the word “hint.” Instead, collaborate with them on the issues you are having. For example, you can say, “my assumptions are X and Y, I’m thinking of doing Z. But I’m struggling with solving [problem].” You can also try questions like,

  • I was wondering if you had any thoughts.
  • Do you think I’m going down the right direction?
  • Do you think my assumptions are incorrect?

With these questions & tips in your back pocket, you should be more than prepared for your next technical onsite interview. Feel like you need more help? Check out these resources to practice more software engineering interview questions.

You can also check out our other interview question lists:

Pathrise is a career accelerator that works with students and professionals 1-on-1 so they can land their dream job in tech. With these tips and guidance, fellows have seen their interview scores double.

If you want to work with any of our mentors 1-on-1 to get help with your software engineer interviews or with any other aspect of the job search, become a Pathrise fellow.

Apply today

Pathrise logo

Leave a Reply

Your email address will not be published. Required fields are marked *