Core Java Interview Questions List - Part I - DZone Java
Core Java Interview Questions List - Part I - DZone Java
Just released, a free O’Reilly book on Reactive Microsystems: The Evolution of Microservices at
Scale. Brought to you in partnership with Lightbend.
As I’ve discussed several times on this site, I’m not a fan of learn by wrote Java questions. However, a
lot of people continue to ask them during their interview process so it means you need to know how to
answer them.
The name of the game is core java interview questions and I will be your quiz master. Each week I will
publish 10 new quick fire questions and answers.
protected- accessible from by any class in the same package or any subclass in any package
default-when no visibility modifier is present. accessible from any class in the same package only.
Strategies and techniques for building scalable and resilient microservices to refactor a monolithic
application step-by-step, a free O'Reilly book. Brought to you in partnership with Lightbend.
Lik Thi A ti l ? R dM
https://dzone.com/articles/core-java-interview-questions-0 F DZ 2/10
6/1/2018 Core Java Interview Questions List: Part I - DZone Java
Published at DZone with permission of Sam Atkinson, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Download Microservices for Java Developers: A hands-on introduction to frameworks and containers.
Brought to you in partnership with Red Hat.
Spring Boot is a tricky framework to understand. In this tutorial for beginnners with Spring Boot, we
will look at the basics of Spring Boot and help you understand the important concepts — Starter
Projects, Auto Configuration, and Starter Parents.
Auto Configuration
We will start with understanding what Spring Boot wants to achieve by comparing it with Spring and
Spring MVC. Once you understand that, you should be in a good position to start with the building
blocks of Spring Boot.
Spring Framework
When DI or IOC is used properly, we can develop loosely coupled applications. And loosely coupled
applications can be easily unit tested.
Spring MVC
Spring Boot
The problem with Spring and Spring MVC is the amount of configuration that is needed:
1 <bean
2 class="org.springframework.web.servlet.view.InternalResourceViewResolver">
3 <property name="prefix">
4 <value>/WEB-INF/views/</value>
5 </property>
6 <property name="suffix">
7 <value>.jsp</value>
https://dzone.com/articles/core-java-interview-questions-0 4/10
6/1/2018 Core Java Interview Questions List: Part I - DZone Java
7 j p
8 </property>
9 </bean>
10
11 <mvc:resources mapping="/webjars/**" location="/webjars/"/>
Spring Boot solves this problem through a combination of Auto Configuration and Starter Projects.
Spring Boot also provides a few features to make building production-ready applications faster.
The following article digs deeper and gives you a full-blown comparison between Spring, Spring MVC,
and Spring Boot.
Spring Boot vs. Spring MVC vs. Spring - How do they compare? Spring Boot Basics URL
How about auto configuring a Data Source if a Hibernate JAR is on the classpath?
How about auto configuring a Dispatcher Servlet if a Spring MVC JAR is on the classpath?
If you want to develop a web application or an application to expose RESTful services, Spring Boot
Start Web is the starter to pick.
The following screenshot shows the different dependencies that are added into our application when
you add Spring Boot Start Web into the dependencies of your project.
This is a wide variety of components that are typically used to develop web applications. Spring Boot
Starter Web brings them together and provides a simple approach to use them.
Spring Boot provides a wide range of starter projects. Spring Initializr suppports all of them and more.
Among the varied range of starter projects and options supported are:
You can explore starter projects in depth with the article below.
Initializing Projects with Spring Boot Starters - Web and JPA Spring Boot Basics URL
1 <parent>
2 <groupId>org.springframework.boot</groupId>
3 <artifactId>spring-boot-starter-parent</artifactId>
4 <version>2.0.0.RELEASE</version>
5 </parent>
Parent POMs allow you to manage the following things for multiple child projects and modules:
You can read more about Spring Boot Starter Parent at the article below.
It allows you to create a varied range of Spring Boot-based applications from a very simple UI. Some
of the types of applications you can bootstrap are:
Web applications
Restful applications
https://dzone.com/articles/core-java-interview-questions-0 7/10
6/1/2018 Core Java Interview Questions List: Part I - DZone Java
Batch applications
Let’s take the example of creating a web application with Spring Initializr.
An embedded server implies that our deployable unit contains the binaries for the server (for example,
tomcat.jar).
1 <dependency>
2 <groupId>org.springframework.boot</groupId>
3 <artifactId>spring-boot-starter-tomcat</artifactId>
4 <version>2.0.0.M6</version>
5 <scope>compile</scope>
6 </dependency>
You can see that, by default, Starter Web includes a dependency on the Starter Tomcat.
https://dzone.com/articles/core-java-interview-questions-0 8/10
6/1/2018 Core Java Interview Questions List: Part I - DZone Java
Spring Boot and Embedded Servers - Tomcat, Jetty, and Spring Boot Project Code on
URL
Undertow Basics Github
Spring Data
From http://projects.spring.io/spring-data/:
To make it simpler, Spring Data provides abstractions (interfaces) you can use irrespective of
underlying data source.
Introduction to Spring Data - Spring Data JPA, Spring Data REST, and
Spring Data URL
MongoDB
Other References
Spring MVC: https://www.youtube.com/watch?v=BjNhGaZDr0Y
Spring Boot: https://www.youtube.com/watch?v=PSP1-2cN7vM
Eclipse: https://www.youtube.com/watch?v=s4ShbtOHMCA
Maven: https://www.youtube.com/watch?v=0CFWeVgzsqY
JUnit: https://www.youtube.com/watch?v=o5k9NOR9lrI
Mockito: https://www youtube com/watch?v=d2KwvXQgQx4
https://dzone.com/articles/core-java-interview-questions-0 9/10
6/1/2018 Core Java Interview Questions List: Part I - DZone Java
Mockito: https://www.youtube.com/watch?v=d2KwvXQgQx4
Topics: SPRING MVC, SPRING BOOT, JAVA, AUTO CONFIGURATION, SPRING INITIALIZR, TUTORIAL
Published at DZone with permission of Ranga Karanam, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
https://dzone.com/articles/core-java-interview-questions-0 10/10