Java Interview Questions - Topic Wise
1. Java Basics & Fundamentals
1. What is meant by Java?
2. Features for using Java
3. Why Java is considered as platform independent?
4. What are the advantages of Java over C++?
5. Why Java is not fully objective oriented?
6. Why does Java not support multiple inheritance?
7. Why Java is not 100% pure OOPS?
8. Public static void main – Explain
9. What are command line arguments? Difference with C?
10. Can a main() method of class be invoked in another class?
11. What is meant by a compilation unit?
12. What is meant by identifiers?
13. What are byte codes?
14. What is meant by JVM, JRE, J2EE, JNI?
15. What are Normalization Rules? Define Normalization?
2. OOPs Concepts
1. What are OOPS concepts in Java?
2. What is meant by encapsulation? Example
3. What is inheritance? Example
4. What is polymorphism? Example
5. What is method overloading?
6. What is method overriding?
7. What is meant by constructor?
8. What is meant by casting?
9. What is abstract class?
10. What is interface?
11. What is the difference between abstract class & interface?
12. Can abstract class be final?
13. Why OOPS? Advantages?
14. What is multiple inheritance? Why not supported?
15. What is singleton class? Implementation?
16. Examples of final class
17. Difference between final, finally, finalize
18. Difference between == & .equals()
19. What is meant by super class? How can you call it?
20. What is anonymous class?
21. What are adapter classes?
22. What is user defined exception?
23. What is wrapper class? Is String a wrapper class?
24. What is enum class?
25. What is difference between Java & C++?
3. Modifiers & Keywords
1. What is use of static, final variable?
2. What is final class, methods and variables?
3. What are access modifiers (public, private, protected, default)?
4. What is protected and friendly?
5. Other modifiers in Java?
6. Is synchronized a modifier?
7. Default modifier in interface?
8. Can we declare variables inside a method as Final?
4. Data Types & Collections
1. What are primitive data types in Java?
2. Difference between array & vector
3. Can Java use multi-dimensional arrays?
4. Name 2 classes you have used
5. Name 2 classes that store arbitrary number of objects
6. Vector class, Dictionary class, HashTable class, Properties class
7. Which class does not allow duplicate elements?
8. What is difference between list & choice?
9. What is resource bundle?
5. Strings
1. Difference between String & StringBuffer
2. What is StringBuilder?
3. How to compare two Strings?
4. How to find length and capacity of StringBuffer?
6. Exception Handling
1. What is Exception?
2. Types of exceptions?
3. Checked & Unchecked exceptions
4. What is throw & throws?
5. What is finally?
6. Can multiple catch be used?
7. Try inside try?
8. What happens to exception object after handling?
9. Purpose of finalize() method?
10. How to avoid runtime exceptions?
11. Use of throws exception
12. User defined exception
7. Multithreading & Concurrency
1. What is Thread?
2. What is multithreading? 2 ways to create thread? Best way?
3. Difference between process & thread
4. Thread-to-thread communication?
5. Difference between sleep & suspend
6. Can a thread be member of another thread?
7. What is deadlock? How to avoid?
8. What are thread priorities?
9. What is synchronization?
10. Garbage collector thread belongs to which priority?
11. What is time slicing?
12. Suppose variable in run() – will threads share or separate copies?
13. What is meant by monitor & synchronization?
14. How two threads can communicate?
8. Garbage Collection & Memory
1. What is Garbage Collection?
2. Why finalize() when GC is present?
3. What is resource leak?
4. What do you know about garbage collector?
9. Packages & Reflection
1. What is meant by package?
2. What are all packages?
3. Difference between [Link].* and [Link]
4. What is default package?
5. What is reflect package & its methods?
6. What is class loader? Types?
10. Applets
1. What is Applet?
2. Restrictions of Applet & accessing local resources
3. Life cycle of Applet (init, start, stop, destroy)
4. When is init(), start() called?
5. Navigating from one Applet to another – methods called
6. Trusted vs Untrusted Applet
7. Applet methods?
8. AppletStub interface
9. What is getCodeBase & getDocumentBase?
10. How to call Applet from HTML?
11. What is Applet Flickering?
12. What is Applet parameter tag?
13. How to communicate between two Applets?
14. Difference between Applet & Application
15. Difference between Applet & JApplet
16. Can Applet have constructor?
17. Applet vs Servlet communication
18. How to call Applet using JavaScript?
11. AWT & Swing (GUI)
1. Difference between AWT & Swing
2. Heavy weight vs Light weight components
3. Event propagation vs Event delegation
4. Event handling – Listeners in Java
5. Adapter classes in event handling
6. Panel vs Frame
7. Default layout of Panel & Frame
8. Scrollbar vs ScrollPanel
9. GridLayout vs GridBagLayout
10. MenuItem vs CheckboxMenuItem
11. What is JFC?
12. Base class for all Swing components?
13. Swing components (JTree, JTable, TabbedPane, etc.)
14. How to expand & collapse nodes in JTree?
15. How to reduce flickering in animation?
16. Swing over AWT – benefits
12. JavaBeans
1. What is JavaBean?
2. Steps to create Bean
3. Properties of Bean
4. Persistence in Beans
5. What is Introspection?
6. What is beanInfo?
7. Interfaces used in Beans
8. Classes used in Beans
9. Difference between Java Class & Bean
13. JDBC
1. What is JDBC?
2. JDBC drivers (4 types)
3. When to use which driver?
4. Latest version of JDBC & new features
5. How to connect Java with DB?
6. What is PreparedStatement?
7. Difference: static query vs dynamic query
8. How to check if data truncated in JDBC?
9. What is Servlet API used for DB connection?
14. RMI, CORBA, Middleware
1. What is RMI? Explain architecture
2. What is CORBA? Difference with RMI
3. What is RMI & Socket?
4. What are IDL files in RMI?
5. What are stubs & skeletons?
6. RMI vs Servlets
7. How to pass parameters in RMI? Why serialize?
8. Server object loading in RMI (true/false)?
9. What if server object not loaded & client requests?
10. What is mapping mechanism used by Java to identify IDL?
11. What is main functionality of Remote Reference Layer?
12. What is middleware?
15. Servlets & JSP
1. What are Servlets? Use of Servlets?
2. GenericServlet vs HttpServlet
3. doPost vs doGet methods
4. Can we use threads in Servlets?
5. How to pass values from HTML to Servlet?
6. How to communicate between Applet & Servlet?
7. Difference between Servlet & Applet
8. Difference between CGI & Servlet
9. What is Session? What is HttpSession class?
10. Session variables in Servlets?
11. Validation in Servlet project?
12. Web Server role in Servlets?
13. Distributed applications in Servlets?
16. Miscellaneous
1. What are Streams in Java?
2. What is StreamTokenizer?
3. What is I/O filter?
4. What is JAR file?
5. What is Manifest file?
6. What is JNI?
7. What is Client-Server computing?
8. What is Socket Programming?
9. What is COM & DCOM?
10. What is E-commerce?
11. Explain 2-tier & 3-tier architecture
12. Explain version control
13. Explain middleware & web server functionality