Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
11 views

CoreJava Tricky

The document provides a comprehensive list of over 50 core Java interview questions and answers aimed at candidates with 1 to 3 years of experience. It covers essential Java concepts, including string comparison, memory management, and the immutability of strings, along with practical coding examples. Additionally, it discusses Java modifiers and resource management techniques introduced in recent Java versions.

Uploaded by

gs23133
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

CoreJava Tricky

The document provides a comprehensive list of over 50 core Java interview questions and answers aimed at candidates with 1 to 3 years of experience. It covers essential Java concepts, including string comparison, memory management, and the immutability of strings, along with practical coding examples. Additionally, it discusses Java modifiers and resource management techniques introduced in recent Java versions.

Uploaded by

gs23133
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

800+ Q&As Menu Contact & reviews Register Login

800+ Big Data & Java Interview FAQs


It pays to prepare & choose from 2-6 offers. Read & Write more code to fast-track & go places with confidence.

Select A to Z of Java & Big Data Techs


search here … Go

Home Why?  Career  Membership 

Home › Quick Prep Java Interview › 300+ Java Interview FAQs 📌 › Java FAQs - 03: Core Java 📌 › 00: Top
50+ Core Java interview questions & answers for 1 to 3 years experience

00: Top 50+ Core Java 300+ Java Interview


Q&As - Quick Prep FAQs

interview questions & 300+ Java Interview FAQs 📌 

answers for 1 to 3 years 150+ Spring & Hibernate


FAQs
📌

experience
150+ Java Architect FAQs

100+ Java code quality Q&As

150+ Java coding Q&As
 Posted on June 24, 2024 

Top 50 core Java interview questions covering core Java concepts


with diagrams, code, examples, and scenarios. If you don’t get these
300+ Big Data Interview
Java interview questions right, you will not be getting an offer.
Q&As - Quick Prep FAQs

== Vs equals(…) 300+ Big Data Interview


FAQs 📌 

250+ Scala Interview FAQs 


Q1. What is the difference between “==” and “equals(…)” in
250+ Python interview
comparing Java String objects?
A1. When you use “==” (i.e. shallow comparison), you are actually
FAQs 📌 

comparing the two object references to see if they point to the same
object. When you use “equals(…)”, which is a “deep comparison” that
compares the actual string values. For example: Key Areas & Companion
Techs FAQs

1 public class StringEquals { 16+ Tech Key Areas FAQs 


2 public static void main(String[ ] args) {
3 String s1 = "Hello";
10+ Companion Tech Q&As 
4 String s2 = new String(s1);
5 String s3 = "Hello";
6
7 System.out.println(s1 + " equals " + s2 + "--> " + s1.equ
8
9 System.out.println(s1 + " == " + s2 + " --> " + (s1 == s2) 
https://www.java-success.com/50-core-java-interview-questions-answers/ 1/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers
10 System.out.println(s1 + " == " + s3 + " -->" + (s1 == s3)) 800+ Enterprise & Core
11 } Java Q&As
12 }
13
300+ Core Java Q&As 

300+ Enterprise Java Q&As 


The variable s1 refers to the String instance created by “Hello”. The
object referred to by s2 is created with s1 as an initializer, thus the
contents of the two String objects are identical, but they are 2
distinct objects having 2 distinct references s1 and s2. This means Java & Big Data Tutorials
that s1 and s2 do not refer to the same object and are, therefore, not
==, but equals( ) as they have the same value “Hello”. The s1 == s3 is Tutorials - Golang 
true, as they both point to the same object due to internal caching.
Tutorials - Big Data 
The references s1 and s3 are interned and points to the same object
Tutorials - Enterprise Java 
in the string pool.

String Pool Caches and you create a String object as a literal without the “new” keyword for caching

In Java 6 — all interned strings were stored in the PermGen – the


fixed size part of heap mainly used for storing loaded classes and
string pool.

In Java 7 – the string pool was relocated to the heap. So, you are not
restricted by the limited size.

String class
Q2. Can you explain how Strings are interned in Java?
A2. String class is designed with the Flyweight design pattern in
mind. Flyweight is all about re-usability without having to create too
many objects in memory.

A pool of Strings is maintained by the String class. When the intern( )


method is invoked, equals(..) method is invoked to determine if the
String already exist in the pool. If it does then the String from the
pool is returned instead of creating a new object. If not already in the
string pool, a new String object is added to the pool and a reference

https://www.java-success.com/50-core-java-interview-questions-answers/ 2/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

to this object is returned. For any two given strings s1 & s2,
s1.intern( ) == s2.intern( ) only if s1.equals(s2) is true.

Two String objects are created by the code shown below. Hence s1
== s2 returns false.

1 //Two new objects are created. Not interned and not recommende
2 String s1 = new String("A");
3 String s2 = new String("A");
4

s1.intern() == s2.intern() returns true, but you have to remember to


make sure that you actually do intern() all of the strings that you’re
going to compare. It’s easy to forget to intern() all strings and then
you can get confusingly incorrect results. Also, why unnecessarily
create more objects?

Instead use string literals as shown below to intern automatically:

1 String s1 = "A";
2 String s2 = "A";
3

s1 and s2 point to the same String object in the pool. Hence s1 ==


s2 returns true.

Since interning is automatic for String literals String s1 = “A”, the


intern( ) method is to be used on Strings constructed with new
String(“A”).

Q3. Why String class has been made immutable in Java?


A3. For performance & thread-safety.

1. Performance: Immutable objects are ideal for representing values


of abstract data (i.e. value objects) types like numbers, enumerated
types, etc. If you need a different value, create a different object. In
Java, Integer, Long, Float, Character, BigInteger and BigDecimal are
all immutable objects. Optimisation strategies like caching of
hashcode, caching of objects, object pooling, etc can be easily
applied to improve performance. If Strings were made mutable,
string pooling would not be possible as changing the string with one
reference will lead to the wrong value for the other references.

2. Thread safety as immutable objects are inherently thread safe as


they cannot be modified once created. They can only be used as 
https://www.java-success.com/50-core-java-interview-questions-answers/ 3/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

read only objects. They can easily be shared among multiple threads
for better scalability.

10 Java String class interview questions and answers

Q. Why is a char array i.e char[] preferred over String to store a


password?
A. String is immutable in Java and stored in the String pool. Once it
is created it stays in the pool until garbage collected. This has
greater risk of 1) someone producing a memory dump to find the
password 2) the application inadvertently logging password as a
readable string.

If you use a char[] instead, you can override it with some dummy
values once done with it, and also logging the char[] like
“[C@5829428e” is not as bad as logging it as String “password123”.

9 Java Garbage Collection interview questions and answers

Java Stack Vs Heap coding


problem
Q4. Can you describe what the following code does and what parts
of memory the local variables, objects, and references to the objects
occupy in Java?

1
2 public class Person {
3
4 //instance variables
5 private String name;
6 private int age;
7
8 //constructor
9 public Person(String name, int age) {
10 this.name = name;
11 this.age = age;
12 }
13
14 public static void main(String[] args) {
15 Person p1 = new Person("John", 25); // "p1" is object
16 String greeting = "Hello"; // "greeting" is a
17 p1.addOneAndPrint(greeting);
18 }
19
20 public void addOneAndPrint(String param) {
21 int valToAdd = 1; // local pri
22
23
this.age = this.age + valToAdd; // instance
System.out.println(param + "! " + this); // calls toS

https://www.java-success.com/50-core-java-interview-questions-answers/ 4/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers
24 }
25
26 @Override
27 public String toString() {
28 return name + " you are now " + age;
29 }
30 }
31
32

A4. The above code outputs “Hello! John you are now 26”. The
following diagram depicts how the different variable references &
actual objects get stored.

Java Stack, Heap, and String Pool

Stack: is where local variables both primitives like int, float, etc &
references to objects in the heap and method parameters are stored
as shown in the above diagram.
Heap: is where objects are stored. For example, an instance of
“Person” with name=”John” and age=25. Strings will be stored in
String Pool within the heap.

Java modifiers are a must-know


Q5. In Java, what purpose does the key words final, finally, and
finalize fulfil?
A5. ‘final‘ makes a variable reference not changeable, makes a
method not overridable, and makes a class not inheritable.

‘finally’ is used in a try/catch statement to almost always execute


the code. Even when an exception is thrown, the finally block is
executed. This is used to close non-memory resources like file

https://www.java-success.com/50-core-java-interview-questions-answers/ 5/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

handles, sockets, database connections, etc till Java 7. This is is no


longer true in Java 7.

Java 7 has introduced the AutoCloseable interface to avoid the


unsightly try/catch/finally(within finally try/catch) blocks to close a
resource. It also prevents potential resource leaks due to not properly
closing a resource.

//Pre Java 7

1 BufferedReader br = null;
2 try {
3 File f = new File("c://temp/simple.txt");
4 InputStream is = new FileInputStream(f);
5 InputStreamReader isr = new InputStreamReader(is);
6 br = new BufferedReader(isr);
7
8 String read;
9
10 while ((read = br.readLine()) != null) {
11 System.out.println(read);
12 }
13 } catch (IOException ioe) {
14 ioe.printStackTrace();
15 } finally {
16 //Hmmm another try catch. unsightly
17 try {
18 if (br != null) {
19 br.close();
20 }
21 } catch (IOException ex) {
22 ex.printStackTrace();
23 }
24 }
25

Java 7 – try can have AutoCloseble types. InputStream and


OutputStream classes now implements the Autocloseable interface.

1 try (InputStream is = new FileInputStream(new File("c://temp/


2 InputStreamReader isr = new InputStreamReader(is);
3 BufferedReader br2 = new BufferedReader(isr);) {
4 String read;
5
6 while ((read = br2.readLine()) != null) {
7 System.out.println(read);
8 }
9 }
10
11 catch (IOException ioe) {
12 ioe.printStackTrace();
13 }
14 
https://www.java-success.com/50-core-java-interview-questions-answers/ 6/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

“try” can now have multiple statements in the parenthesis and each
statement should create an object which implements the new
java.lang.AutoClosable interface. The AutoClosable interface
consists of just one method. void close() throws Exception {}. Each
AutoClosable resource created in the try statement will be
automatically closed without requiring a finally block. If an exception
is thrown in the try block and another Exception is thrown while
closing the resource, the first Exception is the one eventually thrown
to the caller. Think of the close( ) method as implicitly being called
as the last line in the try block. If using Java 7 or later editions, use
AutoCloseable statements within the try block for more concise &
readable code.

In Java 7: When a resource (i.e. dbConnect) is defined outside the


try-with-resource block you need to close it explicitly in the finally
block. You can’t define an object reference in your try-with-resource
block, which was a bug.

1 Connection dbConnect = DriverManager.getConnection("db-url",


2 try (ResultSet rs = dbConnect.createStatement().executeQuery(
3 while (rs.next()) {
4 //read results from rs
5 }
6 } catch (SQLException e) {
7 e.printStackTrace();
8 } finally {
9 if (null != dbConnect)
10 dbConnect.close();
11 }
12 }
13

Java 9 fixed it:

1 Connection dbConnect = DriverManager.getConnection("db-url",


2 try (dbConnect; ResultSet rs = dbConnect.createStatement().exe
3 while (rs.next()) {
4 //read results from rs
5 }
6 } catch (SQLException e) {
7 e.printStackTrace();
8 }
9

‘finalize’ is called when JVM figures out that an object needs to be


garbage collected. You rarely need to override it. It should not be
used to release non-memory resources like file handles, sockets,
database connections, etc because systems have only a finite
number of these resources and you do not know when the Garbage 
https://www.java-success.com/50-core-java-interview-questions-answers/ 7/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

Collection (i.e. GC) is going to kick in to release these non-memory


resources through the finalize( ) method. The finalize is deprecated
from Java 9 onwards, hence should not be used.

So, final and finally are used very frequently in your Java code, but
the modifier finalize is hardly or never used.
It has been deprecated from Java 9 onwards.

6 Java Modifiers every interviewer likes to Quiz you on

What is wrong with this core Java


code?
Q6. What is wrong with the following Java code?

1
2 import java.util.concurrent.TimeUnit;
3
4 class Counter extends Thread {
5
6 //instance variable
7 Integer count = 0;
8
9 // method where the thread execution will start
10 public void run() {
11 int fixed = 6; //local variable
12
13 for (int i = 0; i < 3; i++) {
14 System.out.println(Thread.currentThread().getName
15 + performCount(fixed));
16 try {
17 TimeUnit.SECONDS.sleep(1);
18 } catch (InterruptedException e) {
19 e.printStackTrace();
20 }
21 }
22 }
23
24 // let’s see how to start the threads
25 public static void main(String[] args) {
26 System.out.println(Thread.currentThread().getName() +
27 Counter counter = new Counter();
28
29 //5 threads
30 for (int i = 0; i < 5; i++) {
31 Thread t = new Thread(counter);
32 t.start();
33 }
34
35 }
36
37 //multiple threads can access me concurrently 
38 private int performCount(int fixed) {
https://www.java-success.com/50-core-java-interview-questions-answers/ 8/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers
39 return (fixed + ++count);
40 }
41 }
42

A6. Above code is NOT thread-safe. This is explained in detail at


Heap Vs Stack, Thread safety and Synchronized keyword

More What is wrong with this Java code?

Java Generics – many struggle


with
Q7. When using Generics in Java, when will you use a wild card, and
when will you mot use a wild card?
A7. It depends on what you are trying to do with a collection.

When working with Collection & Generics, you need to ask 4


important questions.

1) Can the RHS be assigned to the LHS?


2) What types of objects can I add to the collection?
3) Is it a read only or read & write collection?
4) When to use which wild card (“? extends”, “? super”) ?

If you do the wrong thing, you will get “compile-time” errors. Also,
note that you can’t use wildcards on the RHS when assigning and
Java 8 supports empty “<>” on the RHS.

“?” is a wild card meaning anything. “? extends Pet” means “anything


that extends a Pet”. Two key points to remember when using the
wild card character “?” are:

Key point 1: you can add

When you are using wildcard List<? super Dog>, means assignable
from anything of type Dog, or any superclasses of type Dog. You can
add any subclasses of type Dog because of polymorphism where a
parent type reference can hold its subclass types.

Key point 2: read only

When you are using wildcard List<? extends Dog>, means assignable
from anything of type Dog, or any subclasses of type Dog. This is
read only, and can’t add anything to this collection.

https://www.java-success.com/50-core-java-interview-questions-answers/ 9/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

In summary:

1. Use the ? extends wildcard if you need to retrieve object from a


data structure. That is read only. You can’t add elements to the
collection.
2. Use the ? super wildcard if you need to add objects to a data
structure.
3. If you need to do both things (i.e. read and add objects), don’t use
any wildcard.

Java Generics in no time interview questions & answers

Java OO concepts
Q8. Can you describe “method overloading” versus “method
overriding”? Does it happen at compile time or runtime?
A8. Overloading deals with multiple methods in the same class with
the same name but different method signatures. Both the below
methods have the same method names but different method
signatures, which mean the methods are overloaded.

1 public class {
2 public static void evaluate(String param1); // overloaded
3 public static void evaluate(int param1); // overloaded
4 }
5

This happens at compile-time. This is also called compile-time


polymorphism because the compiler must decide which method to
run based on the data types of the arguments. If the compiler were
to compile the statement:

1 evaluate(“My Test Argument passed to param1”);


2

It could see that the argument was a “string” literal, and generates
byte code that called method #1.

If the compiler were to compile the statement:

1 evaluate(5);
2


https://www.java-success.com/50-core-java-interview-questions-answers/ 10/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

It could see that the argument was an “int”, and generates byte code
that called method #2.

Overloading lets you define the same operation in different ways for
different data.

Overriding deals with two methods, one in the parent class and the
other one in the child class and has the same name and same
signatures. Both the below methods have the same method names
and the signatures but the method in the subclass “B” overrides the
method in the superclass (aka the parent class) “A”.

Parent class

1 public class A {
2 public int compute(int input) { //method #3
3 return 3 * input;
4 }
5 }
6

Child class

1 public class B extends A {


2 @Override
3 public int compute(int input) { //method #4
4 return 4 * input;
5 }
6 }
7

This happens at runtime. This is also called runtime polymorphism


because the compiler does not and cannot know which method to
call. Instead, the JVM must make the determination while the code
is running.

The method compute(..) in subclass “B” overrides the method


compute(..) in super class “A”. If the compiler has to compile the
following method:

1 public int evaluate(A reference, int arg2) {


2 int result = reference.compute(arg2);
3 }
4

The compiler would not know whether the input argument ‘reference‘
is of type “A” or type “B”. This must be determined during runtime

whether to call method #3 or method #4 depending on what type of
https://www.java-success.com/50-core-java-interview-questions-answers/ 11/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

object (i.e. instance of Class A or instance of Class B) is assigned to


the input variable “reference”.

1 A obj1 = new B( );
2 A obj2 = new A( );
3 evaluate(obj1, 5); // 4 * 5 = 20. method #4 is invoked as sto
4 evaluate(obj2, 5); // 3 * 5 = 15. method #3 is invoked as sto
5

Overriding lets you define the same operation in different ways for
different object types. It is determined by the “stored” object type,
and NOT by the “referenced” object type.

Q. Are overriding & polymorphism applicable static methods as well?


A. No. If you try to override a static method, it is known as hiding or
shadowing.

Core Java Interview Questions & answers will not be complete


without Class Loaders.

How are Java classes loaded into


JVM?
Q9. What do you know about class loading? Explain Java class
loaders? If you have a class in a package, what do you need to do to
run it? Explain dynamic class loading?
A9. Class loaders are hierarchical. Classes are introduced into the
JVM as they are referenced by name in a class that is already
running in the JVM. So, how is the very first class loaded? The very
first class is specially loaded with the help of static main( ) method
declared in your class. All the subsequently loaded classes are
loaded by the classes, which are already loaded and running. A class
loader creates a namespace. All JVMs include at least one class
loader that is embedded within the JVM called the primordial (or
bootstrap) class loader. The JVM has hooks in it to allow user
defined class loaders to be used in place of primordial class loader.
Let us look at the class loaders created by the JVM.


https://www.java-success.com/50-core-java-interview-questions-answers/ 12/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

Java Class Loader Basics

Class loaders are hierarchical and use a delegation model when


loading a class. Class loaders request their parent to load the class
first before attempting to load it themselves. When a class loader
loads a class, the child class loaders in the hierarchy will never
reload the class again. Hence uniqueness is maintained. Classes
loaded by a child class loader have visibility into classes loaded by
its parents up the hierarchy but the reverse is not true as explained in
the above diagram.

Q10. Explain static vs. dynamic class loading?


A10. In static class loading Classes are statically loaded with Java’s
“new” operator. In this case, the retrieval of class definition and
instantiation of the object is done at compile time.

1 class MyClass {
2 public static void main(String args[]) {
3 Car c = new Car( );
4 }
5 }
6

Dynamic loading is a technique for programmatically invoking the


functions of a classloader at runtime. Dynamic class loading is done
when class name is not known at compile time.

Let us look at how to load classes dynamically.

1 //static method which returns a Class


2 Class clazz = Class.forName ("com.Car"); // The value "com.Ca
3


https://www.java-success.com/50-core-java-interview-questions-answers/ 13/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

The above static method “forName” & the below instance (i.e. non-
static method) “loadClass”

1 ClassLoader classLoader = MyClass.class.getClassLoader();


2 Class clazz = classLoader.loadClass(("com.Car"); //Non-static
3

return the class object associated with the class name.Once the
class is dynamically loaded the following method returns an
instance of the loaded class. It’s just like creating a class object with
no arguments.

1 // A non-static method, which creates an instance of a


2 // class (i.e. creates an object).
3 Car myCar = (Car) clazz.newInstance ( );
4

The string class name like “com.Car” can be supplied dynamically at


runtime. Unlike the static loading, the dynamic loading will decide
whether to load the class “com.Car” or the class “com.Jeep” at
runtime based on a runtime condition.

1
2 public void process(String classNameSupplied) {
3 Object vehicle = Class.forName (classNameSupplied).newInsta
4 //......
5 }
6

Static class loading throws NoClassDefFoundError if the class is NOT


FOUND whereas the dynamic class loading throws
ClassNotFoundException if the class is NOT FOUND.

Q. What is the difference between the following approaches?

1 Class.forName("com.SomeClass");

and

1 classLoader.loadClass("com.SomeClass");

A.


https://www.java-success.com/50-core-java-interview-questions-answers/ 14/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

Class.forName(“com.SomeClass”)
— Uses the caller’s classloader and initializes the class (runs static
intitializers, etc.)

classLoader.loadClass(“com.SomeClass
”)
— Uses the “supplied class loader”, and initializes the class lazily (i.e.
on first use). So, if you use this way to load a JDBC driver, it won’t get
registered, and you won’t be able to use JDBC.

The “java.lang.API” has a method signature that takes a boolean flag


indicating whether to initialize the class on loading or not, and a
class loader reference.

1
2 forName(String name, boolean initialize, ClassLoader loader)
3

So, invoking

1 Class.forName("com.SomeClass")

is same as invoking

1 forName("com.SomeClass", true, currentClassLoader)

Q. What are the different ways to create a “ClassLoader” object?A.

1
2 ClassLoader classLoader = Thread.currentThread().getContextCla
3 ClassLoader classLoader = MyClass.class.getClassLoader();
4 ClassLoader classLoader = getClass().getClassLoader();
5

Q. How to load property file from classpath?


A. getResourceAsStream() is the method of java.lang.Class. This
method finds the resource by implicitly delegating to this object’s
class loader.

1
2 final Properties properties = new Properties(); 
https://www.java-success.com/50-core-java-interview-questions-answers/ 15/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers
3 try (final InputStream stream = this.getClass().getResourceAsS
4 properties.load(stream);
5 /* or properties.loadFromXML(...) */
6 }
7

Note: “Try with AutoCloseable resources” syntax introduced with


Java 7 is used above.

Q. What is the benefit of loading a property file from classpath?


A. It is portable as your file is relative to the classpath. You can
deploy the “jar” file containing your “myapp.properties” file to any
location where the JVM is.

Loading it from outside the classpath is


NOT portable

1
2 final Properties properties = new Properties();
3 final String dir = System.getProperty("user.dir");
4
5 try (final InputStream stream = new FileInputStream(dir + "/m
6 properties.load(stream);
7 }
8

As the above code is NOT portable, you must document very clearly
in the installation or deployment document as to where the
.properties file is loaded from because if you deploy your “jar” file to
another location, it might not already have the path “myapp”
configured.

So, loading it via the application classpath is recommended as it is a


portable solution.

Q. What tips would you give to someone who is experiencing a class


loading or “Class Not Found” exception?
A. “ClassNotFoundException” could be quite tricky to troubleshoot.
When you get a ClassNotFoundException, it means the JVM has
traversed the entire classpath and not found the class you’ve
attempted to reference.

3 Java class loading interview questions and answers


https://www.java-success.com/50-core-java-interview-questions-answers/ 16/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

Brushing up for Core Java


interview?
100+ Core Java Interview questions and answers to brush-up prior
to job interviews.

Learn Core Java via Q&As?


300+ Core Java interview questions and answers.

New to Java?
If you are new to Java you can look at: Core Java interview Q&As for
freshers and 17 Java Beginner Interview Questions and Answers.

‹ 27: 50+ SQL scenarios based interview Q&As – identifying consecutive records – job status

repetition

12: PySpark working with SQL syntax Interview Q&As with tutorials ›

About Latest Posts

Arulkumaran Kumaraswamipillai
Mechanical Engineer to self-taught Java engineer in 1999. Contracting since 2002 as a Java Engineer &
Architect and since 2016 as a Big Data Engineer & Architect. Preparation & key know-hows empowered me
to attend 150+ job interviews, choose from 130+ job offers & negotiate better contract rates. Author of the
book "Java/J2EE job interview companion", which sold 35K+ copies & superseded by this site with 3.5K+
registered users Amazon.com profile | Reviews | LinkedIn | LinkedIn Group | YouTube Email: java-
interview@hotmail.com

How to take the road less travelled?


Practicing & brushing up a few Q&As each day on broad number of main stream categories can make a huge impact in 3-12
months.

"You are paid to read & write lots of code & solve business problems in a
collaborative environment"
100+ Free Java Interview FAQs
100+ Free Big Data Interview FAQs 
https://www.java-success.com/50-core-java-interview-questions-answers/ 17/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers
Don't be overwhelmed by the number of Q&As. Job interviews are not technical contests to see who gets most number of questions right.
Nobody knows everything. The Clarity of the answers you give with real-life examples will go a long way in getting you multiple job offers.
It pays to brush-up & choose from 2-6 job offers. Experienced interviewers can easily judge your real experience from a few open-ended
questions & the answers you provide.

If you are pressed for time, popular categories are pinned 📌


for you to prioritise based on the job description. Here are my top career
making know-hows & tips to open more doors as a Java/Big Data Engineer, Architect or Contractor.

1. Feeling stagnated?
2. How to earn more?
3. Freelancing Vs contracting?
4. Self-taught professional?
5. Job Interview Tips
6. Resume Writing Tips

Top 12 popular posts last 30 days


300+ Java Interview Q&As with code, scenarios & FAQs
300+ Core Java Interview Q&As 01. Ice breaker Tell us about yourself? 02. Ice Breaker 8 Java real life scenarios…
(6,669)

300+ Big Data Interview Q&As with code, scenarios & FAQs
100+ SQL Interview Q&As 01. 50+ SQL scenarios based interview Q&As – What is wrong with this SQL code? 02.…
(2,400)

00: Top 50+ Core Java interview questions & answers for 1 to 3 years experience
Top 50 core Java interview questions covering core Java concepts with diagrams, code, examples, and scenarios. If you don't get…
(1,946)

Java 8 String streams and finding the first non repeated character with functional programming
Q1.Find the first non repeated character in a given string input using Java 8 or later? A1.Extends Find the first…
(1,647)

18 Java scenarios based interview Q&As for the experienced – Part 1


Let's look at scenarios or problem statements & how would you go about handling those scenarios in Java. These scenarios…
(1,509)

Membership Levels
Membership prices listed below are in Australian Dollars (A$). If you purchase in other currencies like Indian rupees, the equivalent…
(702)

30+ Java Code Review Checklist Items


This Java code review checklist is not only useful during code reviews, but also to answer an important Java job…
(518)

8 real life Java scenarios with Situation-Action-Result (i.e. SAR) technique


The SAR (Situation-Action-Result) technique is very useful to tackle open-ended questions like: 1. What were some of the challenges you…
(504)

https://www.java-success.com/50-core-java-interview-questions-answers/ 18/19
06/12/2024, 19:05 Top 50+ Core Java interview questions & answers

01: 30+ Java architect interview questions & answers – Part 1


One of the very frequently asked open-ended interview questions for anyone experienced is: Can you describe the high-level architecture of…
(475)

15 Ice breaker interview Q&As asked 90% of the time


Most interviews start with these 15 open-ended questions. These are ice breaker interview questions with no right or wrong answers…
(401)

0: 50+ SQL scenarios based interview Q&As – What is wrong with this SQL code?
This extends 18+ SQL best practices & optimisation interview Q&As. You can practice these SQLs by setting up the data…
(365)

02: 10 Java String class interview Q&As


Java Collection interview questions and answers and Java String class interview questions and answers are must know for any Java…
(349)

Disclaimer
The contents in this Java-Success are copyrighted and from EmpoweringTech pty ltd. The EmpoweringTech pty ltd has the right to correct or enhance the current content without

any prior notice. These are general advice only, and one needs to take his/her own circumstances into consideration. The EmpoweringTech pty ltd will not be held liable for any

damages caused or alleged to be caused either directly or indirectly by these materials and resources. Any trademarked names or labels used in this blog remain the property of

their respective trademark owners. Links to external sites do not imply endorsement of the linked-to sites. Privacy Policy

© 2024 800+ Big Data & Java Interview FAQs Responsive WordPress Theme powered by CyberChimps

Top


https://www.java-success.com/50-core-java-interview-questions-answers/ 19/19

You might also like