Java Interview Guide - Cracked - Sample
Java Interview Guide - Cracked - Sample
Introduction
Interview preparation is an art in itself. There are many books and articles
have been written on the subject, my stand has been little different. It is “Inter-
view” so it means someone is going to look inside me. That way, I believe I must
be ready to showcase with ease, everything that is being searched inside me by
the person who is interviewing.
It is more than two decades now since Java was born, and the coffee is
still hot. Many of us are into Java-line and have been switching jobs often;
many do this with ease while many struggle very hard. “Struggle” - Through this
book, I have made a small attempt to make this struggle thing easy. While this
book would act as a guide to cracking initial rounds of any Java interview; some
of you might also find it useful to gain knowledge on core-java concepts that are
little trickier.
My special thanks to those who have landed here from my Udemy course.
Thank you for following me.
Good luck!
2|Page Java Interview Guide - Cracked
This book is for the person who has some knowledge on Java and wish to
hold a strong grip further on the same; it is also for the people who are serious
about a java job, particularly into web development via the J2EE line. Many
people would call it all "bogus" and repetitive but I must tell you this is the core
of the core java. My course on Udemy (Java Interview Guide: Cracking the first
round) only had questions and this book is to complement the same for the
people who call it incomplete. If my udemy course was designed for the quick
brush up on a night before the java interview, this book has been phrased for a
good preparation well in advance.
Table of Contents
Introduction ........................................................................................................... 1
Who this book is for? ............................................................................................. 2
Who this book is NOT for? ..................................................................................... 2
Preparation ............................................................................................................ 6
Choosing a resume template ............................................................................. 6
Size of resume .................................................................................................... 6
Cover Letter ....................................................................................................... 7
Register to Job Portals ....................................................................................... 7
Importance of Certification.................................................................................... 7
The Interview Questions ........................................................................................ 8
Beginner ............................................................................................................. 8
Version and features ...................................................................................... 8
Some features explained ............................................................................... 9
Java in General ................................................ Error! Bookmark not defined.
OOPs................................................................ Error! Bookmark not defined.
Java language .................................................. Error! Bookmark not defined.
Moderate ............................................................ Error! Bookmark not defined.
Oops Questions ............................................... Error! Bookmark not defined.
Java language .................................................. Error! Bookmark not defined.
Collections ....................................................... Error! Bookmark not defined.
Exception Handling ......................................... Error! Bookmark not defined.
Advanced ............................................................ Error! Bookmark not defined.
4|Page Java Interview Guide - Cracked
Preparation
Choosing a resume template
If you are really serious about your new job search you must prepare your
resume to be eye-catching. It should be clear and informative with all the
information that can land you a job. To start with, you can search for some of the
resume formats online and chose one that best fits with your needs. I googled for
‘resume format doc’ and it gave me 7,43,000 results. While many sites will give
you sample resume formats for free; if you have money you can actually pay some
and get this done.
contact information
Summary/Objective
Educational details
Skills and experience
Accomplishments like awards and certifications
Hobbies (optional)
Personal Info including passport and work permit details
Size of resume
Many people ask me, what should be the size of my resume. While there
are no hard and fast rules to what it can and can not have, anything between2-3
pages should look good. Your resume should contain information that can get you
an invite so it should not be too short that the seeker does not find it interesting
and at the same time it should not be too descriptive that it becomes hard to
search for information that is really required.
7|Page Java Interview Guide - Cracked
Cover Letter
Cover letters are not mandatory on many occasions; however they are
good when communicating through postal mails. Try to keep a format of cover
letter ready always.
Importance of Certification
Yes. Certifications are important. They have their own advantages so
don’t ignore them, employers don’t ignore too. You can search for what are
different certification path available from Oracle. Based on your experience you
can keep yourself updated with matching certificate, they look good on resume
and also when you are preparing for them they make you technically strong in
those areas.
8|Page Java Interview Guide - Cracked
Beginner
Version and features
The idea behind this question is to know if you are with latest technology
changes. I normally chose to answer it this way, "our production systems are on
JDK version XX, while in development we are at JDK version YY". Usually XX would
be a lower version compared to YY.
Lambda expressions
Stream API
Functional interfaces
new Date/Time API
As per Java Language Specification (JLS), the enhanced for statement has the
form:
Let us see how we can use this statement for array type.
10 | P a g e Java Interview Guide - Cracked
package com.org.akhil.main;
for(String s : strArray){
System.out.println(s);
}
}
Drawback of this is that inside the loop we cannot access the index of current
iteration.
The second case is use enhanced for loop for “Iterable” type.
When we look at the Java Docs API, we see that java.util.List has super-interface
as “Iterable” so we can use our enhanced for loop to iterate over a list as below.
package com.org.akhil.main;
import java.util.ArrayList;
import java.util.List;
System.out.println(s);
}
}
}
Now let us look how we can iterate over our own class.
package com.org.akhil.main;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@Override
public Iterator<String> iterator() {
return set.iterator();
}
for(String s : obj){
System.out.println(s);
}
}
}
12 | P a g e Java Interview Guide - Cracked
boolean Boolean
byte Byte
char Character
float Float
int Integer
long Long
short Short
double Double
There are times when Java compiler automatically converts from primitive type
to corresponding wrapper type and vice-versa. The conversion from primitive to
wrapper is called autoboxing and conversion from wrapper to primitive type is
known as unboxing.
So when does the compiler decide to do such conversions? As per java tutorial,
these conversions happen in two cases…
Let us see the first case where method parameters are automatically gets
autoboxed:
13 | P a g e Java Interview Guide - Cracked
package com.org.akhil.Boxing;
package com.org.akhil.Boxing;
package com.org.akhil.Boxing;
package com.org.akhil.Boxing;
}
15 | P a g e Java Interview Guide - Cracked
https://leanpub.com/javainterviewguide-cracked