Job Interview Question Senior Java:

Walter-Tscharf-Development
5 min readApr 17, 2023

When i was a young developer and applied for jobs I had a few job interviews where they asked about my skills in programming java applications. This article summarizes the asked questions.

What java access modifies are existent?

-public: accessible from everywhere.
-protected: accessible by the classes of the same package and the subclasses residing in any package.
-default (no modifier specified): accessible by the classes of the same package.
-private: accessible within the same class only.

Why Java is not 100% Object-oriented?

Java is not 100% Object-oriented because we have data types like boolean, int, or float, which are not objects.

What is the spring framework?

The Spring Framework is a powerful, feature-rich, and well-designed framework for the Java platform. It offers a collection of programming and configuration models that aim to simplify and streamline the development process of robust and testable applications in Java.

What are constructors in Java?

The constructor is a block of code to initiate an object.

What is singleton class in Java?

The singleton Class limits the amount of instances created to only one. We can create one with writing a private constructer.

What is the difference between equals() and == in Java?

== is a binary operator.
The equals method can also compare objects. We can also override the method in a class declaration to make the equals method possible.

What is the super keyword in Java?

It is used to access the parent class object of an instance.

Can you call a constructor of a class inside another constructor?

Yes, we can call a constructor of a class inside another constructor. This is also called as constructor chaining.

What is Hibernate?

First Hibernate is a Java Framework. It provides a object-relational mapping(ORM). That means we have a additional abstraction layer on top, which allows us to map relational database tables to Java classes. Those classes can then be modified or removed added etc.

What are the different loops?

  1. For Loop:

2.While loop

3.ForEach

What is final keyword in Java?

Final value can’t be changed.

How to filter a list in Java?

Use with a for and a if to filter a ArrayList

Use filter with Stream API:

ArrayList listNameAbc = someList
.stream()
.filter(num -> num > 100)
.collect(Collectors.toCollection(ArrayList::new)

How would you declare a ArrayList?

ArrayList aeList = new ArrayList();
aeList.add(“test”);
aeList.add(“teste3w3”);

What is JIT?

Just in time compiler. Compiling byte code at runtime.

What is a class loader?

It is dedicated to load the .class files in Java.

What are the memory allocation methods in Java?

Class Memory
Heap Memory
Stack Memory

Will the program run if I write Static public void main()?

Yes because java does not follow specifics.

What is the JDK?(JDK vs. JRE vs JVM)

JVM(Java Virtual Machine) runs Java bytecode
JRE = JVM + Libraries + Other Components
JDK = JRE + Compilers + Debuggers

What is ORM:

Object Relationship Mapping: That means we map for example Database tables to Java objects.

What is JPA:

Java Persistens API
-> Converts Java commands into actual SQL query
-> crudRep.findByID(2) -> SELECT 1 from Users where ID=2

What is the the n+1 problem?

N+1 query problem is a problem in database retrieval where the related entities of an object are queried individually from a database, leading to O(n) queries where n is the number of related entities of the object.

What is the solid principal?

* Single Responsibility: a class should only have one responsibility.
* Open/Closed: classes should be open for extension but closed for modification. In doing so, we stop ourselves from modifying existing code and causing potential new bugs
* Liskov Substitution: if class A is a subtype of class B, we should be able to replace B with A without disrupting the behavior of our program.
* Interface Segregation: larger interfaces should be split into smaller ones. By doing so, we can ensure that implementing classes only need to be concerned about the methods that are of interest to them.
* Dependency Inversion: The principle of dependency inversion refers to the decoupling of software modules. This way, instead of high-level modules depending on low-level modules, both will depend on abstractions.

What is the difference between spring framework and spring boot?

Everything started with the spring framework. It is a collection of useful reusable code to increase performance for repeatable problems. It increases the speed from sketch to product ready application in Java.
With spring boot we are adding even a higher abstraction class to the spring framework. Therefore we need even less lines of code to build an application.

Which is the newest Java version?

-Version 21 but
-1.8 is the one which uses most dependencies are still vailed for.

Which kind of software architectural pattern do you know?

-MVC: Model view control
-MVVC: Model View View Control

What is the DDD Architecture?

-Domain driven design architecture.
-It is an approach for architecting software design by looking at software in top-down approach.

What is CRUD?

Create, Read, Update, and Delete (CRUD) are the four basic functions that models should be able to do, at most.

Conclusion

Thanks for reading until here. Therefore a short gift for you. Here you can find the PDF for all the questions combined:
https://javainterviewquestions.tiiny.site/

--

--