Introduction The below example shows how to verify that a string contains only numeric value in Java. String may contain float value, double value etc. This example uses regular expression to check a string contains only numeric values. It makes sure that your string should contain only digits and dot(.). You may need sometimes to…

Posted in Java

Verify A String Contains Only Numeric Value Using Java

Introduction This tutorial shows how to merge multiple csv files into one in Java. You may need to merge multiple csv files into one in some situations for your business requirements. Suppose there are n number of csv files and each csv file is having different number of headers, so this example will show you…

Posted in Java

How to merge Multiple CSV Files into One in Java

Introduction The marker interface pattern is a design pattern that provide run-time type information about objects. It provides a means to associate metadata with a class when there is no explicit support for such metadata. The marker interface in Java does not have any method inside it, in other words, a marker interface in Java…

Posted in Java

Marker Interface example in Java

The Externalizable interface provides the necessary means for implementing a custom serialization mechanism. Implementing the Externalizable interface means that we must override writeExternal() and readExternal() methods. These methods will be called when you serialize or deserialize a particular instance or object. The difference between Serialization and Externalization is that when we implement the Serializable interface…

Posted in Java

Externalization example in Java

Introduction We will see here an example on simple log4j configuration in Java. The purpose of inserting log statements into the code is a low-tech method for debugging it. It may also be the only way because debuggers are not always available or applicable. This is often the case for distributed applications.

Posted in Java Log4J

Simple Log4j Configuration in Java

Introduction Here you will see how ThreadLocal works in Java. Java ThreadLocal class is used to create thread-local variables. The thread-local variable can be read and written by the same thread only. In multi-threaded environments all threads of an Object share their variables, so if the variable is not thread safe, then an inconsistent state…

Posted in Java

How ThreadLocal Works In Java

Table of Contents Introduction Prerequisites Reverse A String StringBuffer’s reverse() Method StringBuilder’s reverse() Method Writing Custom Method Using Recursion Using Java 8’s Lambda and Stream API Java main Class Testing String Reverse Source Code Introduction This tutorial will show you string reverse example in Java. You can use various ways to reverse a string in…

Posted in Java

String Reverse Example In Java

Introduction Here in this post I will discuss how singleton pattern works in Java. Singleton pattern is a design solution, where an application wants to have one and only one instance of a class, in all possible scenarios without any exceptional condition. The singleton instance is actually created per JVM but not across multiple JMVs….

Posted in Design Pattern Java

How Singleton Design Pattern Works in Java

Introduction HashMap (also known as HashTable) is, a data structure that can map keys to values, used to implement an associative array. A HashMap uses a hash function to compute an index into an array of buckets or slots, from which the correct value can be found. Ideally, the hash function will assign each key…

Posted in Java

How HashMap Works In Java

Introduction Here I will discuss how to override equals() and hashCode() methods in Java. In Java language the important contract is whenever you override one of the methods (equals() and hashCode()), then you must override the other method. So it means that when you override method equals() then you must override hashCode() or vice versa.

Posted in Java

Override equals() and hashCode() Methods in Java

RSA Encryption/Decryption RSA is a cryptosystem, which is known as one of the first practicable public-key cryptosystems and is widely used for secure data transmission. In such a cryptosystem, the encryption key is public and differs from the decryption key which is kept secret. In RSA, this asymmetry is based on the practical difficulty of…

Posted in Java Security

Encryption And Decryption Using RSA In Java

I am going to show you how to create sticky footer. In other words, this tutorial demonstrates how to keep the footer at the bottom of the page on short documents or pages with little content using CSS and HTML.

Posted in CSS HTML

Sticky footer at bottom using CSS and HTML