1
Learn Java/J2EE core concepts and design/coding issues
With
Java/J2EE Job Interview Companion
By
K.Arulkumaran
Technical Reviewers
Craig Malone
Lara D’Albreo
Stuart Watson
Acknowledgements
A. Sivayini
R.Kumaraswamipillai
Cover Design
K. Arulkumaran
A.Sivayini
2
Java/J2EE
Job Interview Companion
Copy Right 2005 K.Arulkumaran
The author has made every effort in the preparation of this book to ensure the accuracy of the information. However,
information in this book is sold without warranty either express or implied. The author will not be held liable for any
damages caused or alleged to be caused either directly or indirectly by this book.
3
Outline
SECTION DESCRIPTION
What this book will do for you?
Motivation for this book
Key Areas index
SECTION 1
Interview questions and answers on:
Java
Language Fundamentals
Swing
Applet
Performance and memory Leaks.
Personal
SECTION 2
Interview questions and answers on:
Enterprise Java
J2EE
Servlet
JSP
JDBC
JNDI
RMI
EJB
JMS
XML
SQL, Database tuning and O/R mapping
RUP & UML
Struts
Web and Application servers.
Best practices and performance considerations.
Testing and deployment.
Personal
SECTION 3
Putting it all together section.
How would you go about…?
1. How would you go about documenting your Java/J2EE application?
2. How would you go about designing a Java/J2EE application?
3. How would you go about identifying performance problems and/or memory leaks in your Java
application?
4. How would you go about minimising memory leaks in your Java/J2EE application?
5. How would you go about improving performance of your Java/J2EE application?
6. How would you go about identifying any potential thread-safety issues in your Java/J2EE
application?
7. How would you go about identifying any potential transactional issues in your Java/J2EE
application?
8. How would you go about applying the Object Oriented (OO) design concepts in your Java/J2EE
4
application?
9. How would you go about applying the UML diagrams in your Java/J2EE project?
10. How would you go about describing the software development processes you are familiar with?
11. How would you go about applying the design patterns in your Java/J2EE application?
12. How would you go about determining the enterprise security requirements for your Java/J2EE
application?
13. How would you go about describing the open source projects like JUnit (unit testing), Ant (build
tool), CVS (version control system) and log4J (logging tool) which are integral part of most
Java/J2EE projects?
14. How would you go about describing Web services?
SECTION 4 Emerging Technologies/Frameworks
Test Driven Development (TDD).
Aspect Oriented Programming (AOP).
Inversion of Control (IOC) (Also known as Dependency Injection).
Annotations or attributes based programming (xdoclet etc).
Spring framework.
Hibernate framework.
EJB 3.0.
JavaServer Faces (JSF) framework.
SECTION 5 Sample interview questions …
Java
Web Components
Enterprise
Design
General
GLOSSARY OF TERMS
RESOURCES
INDEX
5
Table of contents
Outline_________________________________________________________________________________________ 3
Table of contents ________________________________________________________________________________ 5
What this book will do for you? ____________________________________________________________________ 7
Motivation for this book __________________________________________________________________________ 8
Key Areas Index ________________________________________________________________________________ 10
Java – Interview questions & answers _____________________________________________________________ 11
Java – Language Fundamentals ____________________________________________________________________________ 12
Java – Swing ____________________________________________________________________________________________ 44
Java – Applet____________________________________________________________________________________________ 48
Java – Performance and Memory leaks ______________________________________________________________________ 50
Java – Personal__________________________________________________________________________________________ 53
Java – Key Points ________________________________________________________________________________________ 56
Enterprise Java – Interview questions & answers ____________________________________________________ 59
Enterprise - J2EE ________________________________________________________________________________________ 60
Enterprise - Servlet _______________________________________________________________________________________ 69
Enterprise - JSP _________________________________________________________________________________________ 77
Enterprise - JDBC ________________________________________________________________________________________ 83
Enterprise – JNDI & LDAP _________________________________________________________________________________ 87
Enterprise - RMI _________________________________________________________________________________________ 90
Enterprise – EJB 2.x ______________________________________________________________________________________ 94
Enterprise - JMS ________________________________________________________________________________________ 110
Enterprise - XML ________________________________________________________________________________________ 114
Enterprise – SQL, Tuning and O/R mapping _________________________________________________________________ 119
Enterprise - RUP & UML __________________________________________________________________________________ 126
Enterprise - Struts_______________________________________________________________________________________ 133
Enterprise - Web and Application servers ___________________________________________________________________ 137
Enterprise - Best practices and performance considerations ___________________________________________________ 139
Enterprise – Logging, testing and deployment _______________________________________________________________ 141
Enterprise - Personal ____________________________________________________________________________________ 144
Enterprise – Software development process _________________________________________________________________ 144
Enterprise – Key Points __________________________________________________________________________________ 146
How would you go about…?_____________________________________________________________________ 151
Q 01: How would you go about documenting your Java/J2EE application? ____________________________________ 152
Q 02: How would you go about designing a Java/J2EE application? __________________________________________ 153
Q 03: How would you go about identifying performance and/or memory issues in your Java/J2EE application? _____ 156
Q 04: How would you go about minimising memory leaks in your Java/J2EE application? _______________________ 157
Q 05: How would you go about improving performance in your Java/J2EE application? _________________________ 157
Q 06: How would you go about identifying any potential thread-safety issues in your Java/J2EE application?_______ 158
Q 07: How would you go about identifying any potential transactional issues in your Java/J2EE application? _______ 159
Q 08: How would you go about applying the Object Oriented (OO) design concepts in your Java/J2EE application? _ 160
Q 09: How would you go about applying the UML diagrams in your Java/J2EE project? _________________________ 162