Java Interview Question Answers

  1. What are the main differences between Java and C++?
  2. What are the various components of JDK (Java Development Kit) environment?
  3. What are Java source file declaration rules?
  4. What is Java Bytecode (.class file)?
  5. Why is main method public static and void in Java? Will the program compile, if the main method is not static?
  6. Which Java packages are imported by default?
  7. What are Java array literals? How to Use Array Literals in Java?
  8. What are the differences between finalize method, finally block, and final keyword in Java?
  9. What is the use of finally block in exception handling in Java?
  10. What are the uses of final keyword in Java?
  11. String intern() method in Java. Why we use it?
  12. System.out.println() in Java. How does it work?
  13. How to create immutable class in Java? Why immutable class should be marked final? What are the advantages and disadvantages of immutable classes?
  14. What are the differences between abstract class and interface in Java?
  15. How to Override equals() Method in Java?
  16. What is the use of instanceof or type comparison operator in Java?
  17. What is the difference between instanceof operator and isInstance() method in Java?
  18. What is JIT (Just-In-Time) Compiler in Java? Explain JIT Compilation.
  19. What is abstract interface in Java?
  20. Does Java support multi-dimensional arrays?
  21. What are the differences between thread and process in Java?
  22. How to find the size of a primitive data type in Java?
  23. What is the difference between path and classpath in Java?
  24. Is Java platform independent? Why and How?
  25. Difference between public static void main and static public void main in Java?
  26. Which are four access modifiers in Java?
  27. How to Prevent Method Overriding In Java Inheritance?
  28. Explain OOP Concepts With Real Time Examples.
  29. Difference Between Constructor and Method in Java.
  30. Can We Override Static Method in Java?
  31. Can We Override Overloaded Method in Java?
  32. Can We Override Private Method in Java?
  33. Can We Make Constructor Static in Java?
  34. Can We Run Java Program Without Main Method?
  35. Can We Make Constructor Final in Java?
  36. Can You Use Abstract and Final Both With A Method In Java?
  37. Can We Declare an Interface Final in Java?
  38. Difference Between Static and Dynamic Class Loading in Java
  39. Which is the Base Class of all Exceptions in Java?
  40. Can We Declare Main() Method Final in Java?
  41. Why Java Doesn't Support Multiple Inheritance?
  42. What is the execution order of blocks, static blocks, constructors, and methods in Java?
  43. What is marker interface in Java?
  44. How to create user defined or custom exception class in Java?
  45. Can we run abstract class in Java that has main method?
  46. When does finally block not execute in Java?
  47. Difference Between Error and Exception in Java. Error vs Exception
  48. Difference between throw and throws in Java
  49. Difference between Checked and Unchecked Exceptions in Java
  50. What is Exception Propagation in Java? Explain.
  51. Difference between Set and List in Java
  52. What is Unmodifiable Collection in java?
  53. What is UnSupportedOperationException in Java?
  54. Difference between peek poll and remove method of the Queue interface in Java?
  55. Difference between ArrayList and Vector in Java
  56. Difference between HashMap and HashTable in Java
  57. Difference between Iterator And Enumeration in Java
  58. Difference between Iterator and ListIterator in Java
  59. Difference between Fail Fast and Fail Safe iterator in Java
  60. How fail fast iterator comes to know that the internal structure is modified?
  61. Difference between HashSet and TreeSet in Java
  62. Difference between HashMap and ConcurrentHashMap in Java


Share this page on WhatsApp

Get Free Tutorials by Email

About the Author

is the founder and main contributor for cs-fundamentals.com. He is a software professional (post graduated from BITS-Pilani) and loves writing technical articles on programming and data structures.