Core Java Interview Questions and Answers
Difficulty Level: AllBeginnerExpert
Ques 1. In which case, do we need abstract classes with no abstract methods?
Ques 2. What's the use of concrete methods in abstract classes?
Ques 3. Can a method be static and synchronized?
Ques 4. What is Cloneable Interface in Core Java?
Ques 5. Difference between wait, notify and notifyAll in Core Java.
Ques 6. What is abstraction?
Ques 7. String vs StringBuffer vs StringBuilder in Java
Ques 8. What is Encapsulation in Java and OOPS with Example?
Ques 9. Difference between Thread and Runnable interface in Java?
Ques 10. Difference between Wait and Sleep , Yield in Java
Ques 11. Difference between Vector and ArrayList in Java
Ques 12. What is Checked Exception and its use in java?
Ques 13. What is Unchecked Exception in java?
Ques 14. What is Anonymous (inner) Class in java?
Ques 15. What is the difference amongst JVM Spec, JVM Implementation, JVM Runtime ?
Ques 16. What is JIT and its use?
Ques 17. How will you get the platform dependent values like line separator, path separator, etc., ?
Ques 18. What comes to mind when someone mentions a shallow copy and deep copy in Java?
Ques 19. Why are there no global variables in Java?
Ques 20. Which Java operator is right associative?
Ques 21. Describe what happens when an object is created in Java?
Ques 22. How are commas used in the intialization and iteration parts of a for statement?
Ques 23. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?
Ques 24. How many methods in the Serializable interface?
Ques 25. How many methods in the Externalizable interface?
Ques 26. What is the difference between Serializalble and Externalizable interface?
Ques 27. What is the difference between a static and a non-static inner class?
Ques 28. What is reflection?
Ques 29. Can an anonymous class be declared as implementing an interface and extending a class?
Ques 30. Why isn't there operator overloading?
Ques 31. What does the keyword "synchronize" mean in java. When do you use it? What are the disadvantages of synchronization?
Ques 32. What synchronization constructs does Java provide? How do they work?
Ques 33. Do I need to use synchronized on setValue(int)?
Ques 34. Which class is the wait() method defined in? I get incompatible return type for my thread getState( ) method!
Ques 35. What is a working thread?
Ques 36. What is a green thread?
Ques 37. What are the different level lockings using the synchronization keyword?
Ques 38. What is synchronization and why is it important?
Ques 39. Can a lock be acquired on a class?
Ques 40. What is a task's priority and how is it used in scheduling?
Ques 41. What is a daemon thread?
Ques 42. If an object is garbage collected, can it become reachable again?
Ques 43. What is garbage collection? What is the process that is responsible for doing that in java?
Ques 44. What is the finalize method do?
Ques 45. What is the implementation of destroy method in java.. is it native or java code?
Ques 46. How many times may an object's finalize() method be invoked by the garbage collector?
Ques 47. How can you minimize the need of garbage collection and make the memory use more effective?
Ques 48. Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?
Ques 49. If a class is located in a package, what do you need to change in the OS environment to be able to use it?
Ques 50. What interface do you implement to do the sorting?
Ques 51. What is the significance of ListIterator?
Ques 52. What are order of precedence and associativity, and how are they used?
Ques 53. What is nested class?
Ques 54. Why do threads block on I/O?
Ques 55. What an I/O filter?
Ques 56. What value does read() return when it has reached the end of a file?
Ques 57. What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
Ques 58. How will you invoke any external process in Java?
Ques 59. What is skeleton and stub? what is the purpose of those?
Ques 60. Can you write a Java class that could be used both as an applet as well as an application?
Ques 61. What is a DatabaseMetaData?
Ques 62. In a statement, I am executing a batch. What is the result of the execution?