Blog Archives
1 11 12 13 14 15

Understanding Open/Closed Principle (OCP) from the SOLID OO principles with a Java example

Q. Is there anything wrong with the following class design? If yes, can the design be improved?

JUnit test class.

A. It’s not a good idea to try to anticipate changes in requirements ahead of time, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Understanding Overriding, Hiding, and Overloading in Java? How does overriding give polymorphism?

Overriding, Hiding, and Overloading are important core Java concepts and you will be quizzed on job interviews or written tests.

What is overriding?

An instance method overrides all accessible instance methods with the same signature in super classes. If overriding were not possible,

Read more ›



What are good real life Java inheritance (or use of abstract classes) examples ?

We have already looked at Why favor composition over inheritance? with reasoning and code examples. Inheritance still has its use and let’s look at some real life examples. #1. Unit Test Classes

In the base class you can wire up Spring configs, shared logic, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Why favour composition over inheritance?

This is not only one of the most popular Java OOP Interview Questions & Answers asked 90% of the time in job interviews, but also a key OOP concept you must know well. The correct answer depends on the problem you are trying to solve, and the answer you give...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Working with .properties config files in Java

Managing properties for an enterprise application can be a bit trickier than one might expect.

Q: How would you go about managing properties files in your application?
A: One great advantage of property files is that they let you change your application’s configuration without recompilation.

Read more ›



Yammer metrics tutorial with JMX to gather metrics

Note: Yammer metrics has now moved to metrics-core.

from com.yammer.metrics:metrics-core:2.2.0 (NOT supported anymore) to com.codahale.metrics:metrics-core:3.0.*

from com.codahale.metrics:metrics-core:3.0.* to io.dropwizard.metrics:metrics-core:3.1.* since 2014.

When you are running long term applications like web applications, batch jobs,

Read more ›



1 11 12 13 14 15

300+ Java Interview FAQs

Tutorials on Java & Big Data