You'll likely be asked difficult questions during the interview. Preparing the list of likely questions in advance will help you easily transition from question to question.
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Top java j2ee interview questions and answers job interview tips
1. Top 20 java j2ee interview questions
and answers
If you need top 7 free ebooks below for your job interview, please visit:
4career.net
• Free ebook: 75 interview questions and answers
• Top 12 secrets to win every job interviews
• 13 types of interview quesitons and how to face them
• Top 8 interview thank you letter samples
• Top 7 cover letter samples
• Top 8 resume samples
• Top 15 ways to search new jobs
Interview questions and answers – free pdf download Page 1 of 30
2. Tell me about yourself?
This is probably the most asked
question in java j2ee interview. It
breaks the ice and gets you to talk
about something you should be fairly
comfortable with. Have something
prepared that doesn't sound rehearsed.
It's not about you telling your life story
and quite frankly, the interviewer just
isn't interested. Unless asked to do so,
stick to your education, career and
current situation. Work through it
chronologically from the furthest back
to the present.
Interview questions and answers – free pdf download Page 2 of 30
3. What is final, finalize() and finally?
final : final keyword can be used for class,
method and variables. A final class cannot
be subclassed and it prevents other
programmers from subclassing a secure
class to invoke insecure methods. A final
method can’t be overridden. A final
variable can’t change from its initialized
value. finalize() : finalize() method is used
just before an object is destroyed and can
be called just prior to garbage collection.
finally : finally, a key word used in
exception handling, creates a block of code
that will be executed after a try/catch block
has completed and before the code
following the try/catch block. The finally
block will execute whether or not an
exception is thrown. For example, if a
method opens a file upon exit, then you
will not want the code that closes the file
to be bypassed by the exception-handling
Interview questions and answers – free pdf download Page 3 of 30
4. mechanism. This finally keyword is
designed to address this contingency.
What Can You Do for Us That Other Candidates
Can't?
What makes you unique? This
will take an assessment of
your experiences, skills and
traits. Summarize concisely:
"I have a unique combination
of strong technical skills, and
the ability to build strong
customer relationships. This
allows me to use my
knowledge and break down
information to be more user-friendly."
Interview questions and answers – free pdf download Page 4 of 30
5. What is the difference between Integer and int?
Integer is a class defined in the java.
lang package, whereas int is a primitive
data type defined in the Java language
itself. Java does not automatically
convert from one to the other. b) Integer
can be used as an argument for a
method that requires an object, whereas
int can be used for calculations.
Interview questions and answers – free pdf download Page 5 of 30
6. A Vector is declared as follows. What happens if
the code tried to add 6 th element to this Vector
new vector(5,10) ANS: The element
will be successfully added and The
Vector allocates space to
accommodate up to 15
elements EXPLANATION: The 1
st argument in the constructor is the
initial size of Vector and the 2 nd
argument in the constructor is the
growth in size (for each allocation)
This Vector is created with 5
elements and when an extra element
(6 th one) is tried to be added, the
vector grows in size by
Interview questions and answers – free pdf download Page 6 of 30
7. What is transient variable?
Transient variable can't be serialize.
For example if a variable is declared
as transient in a Serializable class and
the class is written to an
ObjectStream, the value of the
variable can't be written to the stream
instead when the class is retrieved
from the ObjectStream the value of
the variable becomes null.
Interview questions and answers – free pdf download Page 7 of 30
8. What do you understand by Synchronization?
Synchronization is a process of
controlling the access of shared resources
by the multiple threads in such a manner
that only one thread can access one
resource at a time. In non synchronized
multithreaded application, it is possible
for one thread to modify a shared object
while another thread is in the process of
using or updating the object's value.
Synchronization prevents such type of
data corruption.
E.g. Synchronizing a function:
public synchronized void Method1 () {
// Appropriate method-related code.
}
public myFunction (){
synchronized (this) {
// Synchronized code here.
}
}
Interview questions and answers – free pdf download Page 8 of 30
9. What is similarities/difference between an
Abstract class and Interface?
Differences are as follows:
Interfaces provide a form of multiple
inheritance. A class can extend only one
other class.
Interfaces are limited to public methods and
constants with no implementation. Abstract
classes can have a partial implementation,
protected parts, static methods, etc.
A Class may implement several interfaces.
But in case of abstract class, a class may
extend only one abstract class.
Interfaces are slow as it requires extra
indirection to to find corresponding method
in in the actual class. Abstract classes are
fast.
Similarities:
Neither Abstract classes or Interface can be
instantiated.
Interview questions and answers – free pdf download Page 9 of 30
10. Explain the user defined Exceptions?
User defined Exceptions are the
separate Exception classes defined by
the user for specific purposed. An user
defined can created by simply sub-classing
it to the Exception class. This
allows custom exceptions to be
generated (using throw) and caught in
the same way as normal exceptions.
Example:
class myCustomException extends
Exception {
// The class simply has to exist to
be an exception
}
Interview questions and answers – free pdf download Page 10 of 30
11. Explain garbage collection?
Garbage collection is one of the most
important feature of Java. Garbage collection
is also called automatic memory management
as JVM automatically removes the unused
variables/objects (value is null) from the
memory. User program cann't directly free
the object from memory, instead it is the job
of the garbage collector to automatically free
the objects that are no longer referenced by a
program. Every class inherits finalize()
method from java.lang.Object, the finalize()
method is called by garbage collector when it
determines no more references to the object
exists. In Java, it is good idea to explicitly
assign null into a variable when no more in
use. I Java on calling System.gc() and
Runtime.gc(), JVM tries to recycle the
unused objects, but there is no guarantee
when all the objects will garbage collected.
Interview questions and answers – free pdf download Page 11 of 30
12. Explain the Polymorphism principle.
The meaning of Polymorphism is
something like one name many forms.
Polymorphism enables one entity to be
used as as general category for different
types of actions. The specific action is
determined by the exact nature of the
situation. The concept of polymorphism
can be explained as "one interface,
multiple methods".
Interview questions and answers – free pdf download Page 12 of 30
13. What is Collection API?
The Collection API is a set of
classes and interfaces that
support operation on
collections of objects. These
classes and interfaces are
more flexible, more powerful,
and more regular than the
vectors, arrays, and
hashtables if effectively
replaces.
Example of classes: HashSet,
HashMap, ArrayList,
LinkedList, TreeSet and
TreeMap.
Example of interfaces:
Collection, Set, List and Map.
Interview questions and answers – free pdf download Page 13 of 30
14. How to define an Interface?
In Java Interface defines the methods
but does not implement them. Interface
can include constants. A class that
implements the interfaces is bound to
implement all the methods defined in
Interface.
Emaple of Interface:
public interface sampleInterface {
public void functionOne();
public long CONSTANT_ONE =
1000;
}
Interview questions and answers – free pdf download Page 14 of 30
15. How to define an Abstract class?
A class containing abstract method is called
Abstract class. An Abstract class can't be
instantiated.
Example of Abstract class:
abstract class testAbstractClass {
protected String myString;
public String getMyString() {
return myString;
}
public abstract string
anyAbstractFunction();
}
Interview questions and answers – free pdf download Page 15 of 30
16. Explain the Encapsulation principle?
Encapsulation is a process of binding or
wrapping the data and the codes that
operates on the data into a single entity.
This keeps the data safe from outside
interface and misuse. One way to think
about encapsulation is as a protective
wrapper that prevents code and data
from being arbitrarily accessed by other
code defined outside the wrapper.
Interview questions and answers – free pdf download Page 16 of 30
17. Explain the new Features of JDBC 2.0 Core API?
The JDBC 2.0 API includes the complete JDBC API,
which includes both core and Optional Package API,
and provides inductrial-strength database computing
capabilities.
New Features in JDBC 2.0 Core API:
Scrollable result sets- using new methods in the
ResultSet interface allows programmatically move the
to particular row or to a position relative to its current
position
JDBC 2.0 Core API provides the Batch Updates
functionality to the java applications.
Java applications can now use the
ResultSet.updateXXX methods.
New data types - interfaces mapping the SQL3 data
types
Custom mapping of user-defined types (UTDs)
Miscellaneous features, including performance
hints, the use of character streams, full precision
for java.math.BigDecimal values, additional
security, and support for time zones in date, time,
and timestamp values.
Interview questions and answers – free pdf download Page 17 of 30
18. What is Garbage Collection and how to call it
explicitly?
When an object is no longer referred to
by any variable, java automatically
reclaims memory used by that object.
This is known as garbage collection.
System. gc() method may be used to
call it explicitly.
Interview questions and answers – free pdf download Page 18 of 30
19. What is the difference between String and String
Buffer?
String objects are constants and
immutable whereas StringBuffer
objects are not. b) String class
supports constant strings whereas
StringBuffer class supports growable
and modifiable strings.
Interview questions and answers – free pdf download Page 19 of 30
20. What are Access Specifiers available in Java?
Access specifiers are keywords that
determines the type of access to the
member of a class. These are:
Public
Protected
Private
Defaults
Interview questions and answers – free pdf download Page 20 of 30
21. Explain the different forms of Polymorphism?
From a practical programming
viewpoint, polymorphism exists in
three distinct forms in Java:
Method overloading
Method overriding through inheritance
Method overriding through the Java
interface
Interview questions and answers – free pdf download Page 21 of 30
22. Useful job interview materials:
If you need top free ebooks below for your job interview, please visit:
4career.net
• Free ebook: 75 interview questions and answers
• Top 12 secrets to win every job interviews
• Top 36 situational interview questions
• 440 behavioral interview questions
• 95 management interview questions and answers
• 30 phone interview questions
• Top 8 interview thank you letter samples
• 290 competency based interview questions
• 45 internship interview questions
• Top 7 cover letter samples
• Top 8 resume samples
• Top 15 ways to search new jobs
Interview questions and answers – free pdf download Page 22 of 30
23. Top 6 tips for job interview
Interview questions and answers – free pdf download Page 23 of 30
24. Tip 1: Do your homework
You'll likely be asked difficult questions
during the interview. Preparing the list of
likely questions in advance will help you
easily transition from question to question.
Spend time researching the company. Look
at its site to understand its mission statement,
product offerings, and management team. A
few hours spent researching before your
interview can impress the hiring manager
greatly. Read the company's annual report
(often posted on the site), review the
employee's LinkedIn profiles, and search the
company on Google News, to see if they've
been mentioned in the media lately. The
more you know about a company, the more
you'll know how you'll fit in to it.
Ref material: 4career.net/job-interview-checklist-
40-points
Interview questions and answers – free pdf download Page 24 of 30
25. Tip 2: First impressions
When meeting someone for the first time, we
instantaneously make our minds about various aspects of
their personality.
Prepare and plan that first impression long before you
walk in the door. Continue that excellent impression in the
days following, and that job could be yours.
Therefore:
· Never arrive late.
· Use positive body language and turn on your charm
right from the start.
· Switch off your mobile before you step into the
room.
· Look fabulous; dress sharp and make sure you look
your best.
· Start the interview with a handshake; give a nice
firm press and then some up and down movement.
· Determine to establish a rapport with the interviewer
right from the start.
· Always let the interviewer finish speaking before
giving your response.
· Express yourself fluently with clarity and precision.
Useful material: 4career.net/top-10-elements-to-make-a-
Interview questions and answers – free pdf download Page 25 of 30
26. good-first-impression-at-a-job-interview
Tip 3: The “Hidden” Job Market
Many of us don’t recognize that hidden job
market is a huge one and accounts for 2/3
of total job demand from enterprises. This
means that if you know how to exploit a
hidden job market, you can increase your
chance of getting the job up to 300%.
In this section, the author shares his
experience and useful tips to exploit hidden
job market.
Here are some sources to get penetrating
into a hidden job market: Friends; Family;
Ex-coworkers; Referral; HR communities;
Field communities; Social networks such
as Facebook, Twitter…; Last recruitment
ads from recruiters; HR emails of potential
recruiters…
Interview questions and answers – free pdf download Page 26 of 30
27. Tip 4: Do-It-Yourself Interviewing Practice
There are a number of ways to prepare
for an interview at home without the
help of a professional career counselor
or coach or a fee-based service.
You can practice interviews all by
yourself or recruit friends and family to
assist you.
Useful material: 4career.net/free-ebook-
75-interview-questions-and-answers
Interview questions and answers – free pdf download Page 27 of 30
28. Tip 5: Ask questions
Do not leave the interview without
ensuring that you know all that you
want to know about the position. Once
the interview is over, your chance to
have important questions answered has
ended. Asking questions also can show
that you are interested in the job. Be
specific with your questions. Ask about
the company and the industry. Avoid
asking personal questions of the
interviewer and avoid asking questions
pertaining to politics, religion and the
like.
Ref material: 4career.net/25-questions-to-
ask-employers-during-your-job-interview
Interview questions and answers – free pdf download Page 28 of 30
29. Tip 6: Follow up and send a thank-you note
Following up after an interview can
help you make a lasting impression and
set you apart from the crowd.
Philip Farina, CPP, a security career
expert at Manta Security Management
Recruiters, says: "Send both an email as
well as a hard-copy thank-you note,
expressing excitement, qualifications
and further interest in the position.
Invite the hiring manager to contact you
for additional information. This is also
an excellent time to send a strategic
follow-up letter of interest."
Ref material: 4career.net/top-8-
interview-thank-you-letter-samples
Interview questions and answers – free pdf download Page 29 of 30