Administrator

Lokesh Gupta

A fun-loving family man, passionate about computers and problem-solving, with over 15 years of experience in Java and related technologies. An avid Sci-Fi movie enthusiast and a fan of Christopher Nolan and Quentin Tarantino.

Website: https://howtodoinjava.com

Github: https://github.com/lokeshgupta1981/

Twitter: @HowToDoInJAVA

LinkedIn: https://www.linkedin.com/in/lokeshgupta1981/

My Articles:

Dropwizard Health Check Configuration Example

DropWizard health check is implemented by extending the HealthCheck class and returning Result.healthy() if everything is alright and Result.unhealthy() if something is not working – as expected.

Java Locale: A Comprehensive Guide

Learn about Localization and Internationalization with Locale. Learn to create Locale objects and use them for formatting dates and messages.

Difference between Externalizable and Serializable in Java

Knowing the difference between Externalizable vs Serializable is important in two aspects, one – if could be asked as an interview question, two – you can use the knowledge to make better informed decision for performance improvement for applying serialization into your application.

Generating Random Numbers in Java

Learn to use java.util.Random, Math.random(), SecureRandom and ThreadLocalRandom to generate random numbers based on your application requirements.

Java Classpath

Use given syntax examples for setting CLASSPATH for any java application runtime, in windows and linux environments.

Log4j2 HTMLLayout Configuration Example

This Log4j2 example will help you in configuring log4j2.xml file with HTMLLayout. The HTMLLayout generates an HTML page and adds each log statement to a row in a table.

Log4j2 – Useful Log Format Pattern Layouts

Given log4j2 conversion patterns are for reference so that you and me don’t waste time to build these patterns everytime we are creating/editing log4j configuration files.

Log4j2 JSON Configuration Example

Apache Log4j 2 is an upgrade to Log4j 1.x that provides significant improvements over its predecessor such as performance improvement, automatic reloading of modified configuration files, Java 8 lambda support and custom log levels. In addition to XML and properties files, Log4j2 can be configured using JSON also. 1. Log4j2 …

Log4j2 Properties File Example

Log4j2 properties tutorial. Learn to configure log4j2.properties file to output to console, rolling files etc. Learn log4j2 appenders, levels and patterns.

Top 10 Java Blogs and Websites

Over last 9 years, I have found these top 10 java websites most useful for me. I do not intend to rank them for their popularity, but how much useful they have been for me in my career.

Java OOP Concepts with Examples

In this Java OOPs concepts tutorial, we will learn four major object oriented principles– abstraction, encapsulation, inheritance, and polymorphism. They are also known as four pillars of the object oriented programming paradigm.

Java Programs to Calculate Factorial

We may be asked to write a program to calculate factorial during coding exercises in Java interviews. This always better to have an idea of how to build such a factorial program. 1. What is Factorial? The factorial of a number is the product of all positive descending integers up to …

JMS Point-To-Point Message Example

In JMS tutorial, you read about JMS messaging domains Point to Point Domain and Publish Subscribe Domain. In this example, we will go through one such example of point to point messaging domain. In point to point message the sender delivers the message to the queue and a single receiver …

JMS Tutorial – Java Message Service Tutorial

Java Message Service is an API that supports the formal communication called messaging between computers on a network. JMS provides a common interface for standard message protocols and message services in support of the Java programs. JMS provides the facility to create, send and read messages. The JMS API reduces …

Producer Consumer Problem Using BlockingQueue

BlockingQueue is excellent when you want to skip the complexity involved in wait–notify statements. This BlockingQueue can be used to solve the producer-consumer problem as well as given blow example. As this problem is well known to every programmer, I am not going in detail of problem description. How BlockingQueue …

Iterate through a Collection in Java

Learn different techniques to iterate over a Java Collection (List, Set and Map) using for-loop, enhanced for-loop, Iterator and Java Stream.

Parse a String to Date in Java 8

Learn to convert a string to date in Java 8 using the new date time API classes such as LocalDate, LocalDateTime, ZonedDateTime and DateTimeFormatter. 1. Convert string to date in ISO8601 format By default, java dates are in ISO8601 format, so if you have any string which represents a date …

Reverse a String in Java

Learn to write Java programs to reverse a String. Learn how to reverse the characters of a string and then how to reverse the words.

Java Thread Life Cycle and States

Learn about the lifecycle of a Thread in Java, and how the state transitions happen between different states of the Thread by JVM and OS.

Jersey Entity Data Filter Example

Learn to configure and use SelectableEntityFilteringFeature for implementing the entity data filtering in Jersey controlled from the clients.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.