This example highlights the way how to invoke a method using the reflection API. As we are aware that we can dynamically invoke a method in another class by using the reflection classes. Note that using reflection is more expensive in terms of performance. This programming practice is used only in the certain requirements where …
Fibonacci Number Generation in Java
This simple example explains how to write a Java program to print the fibonacci numbers. Fibonacci numbers are sequence of numbers where one number is the sum of preceding two numbers. An example for the fibonacci is “0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …”. If you look at the series, every …
Prime Number Generation in Java
This simple example demonstrates how to get the prime numbers using Java program for the given range. What is prime number?. A number which is divided only by 1 and itself is known as the prime number. If you take an example, 7 is a prime number, because it can be divided by only itself(7) …
Java equals() and hashcode()
This tutorial explains the equals() and hashcode() method in simple terms. It is one of the confusing questions on the Java developer’s mind. The common questions asked about these methods are: What is equals() method and why should I override that in our classes? What is hashcode() method? Why should I always override hashcode() when …
HTML5 – Datalist Vs Select Tags
In our previous tutorial I have explained HTML5 Datalist with a simple example. If you are a novice HTML programmer, then you would have a confusion on difference between <datalist> and <select> elements. The reality is that, both are used for the entirely different purposes. Datalist Tag This tag is used for suggesting the possible …
WildFly 8 Final is released!
WildFly 8 Application server (formerly known as JBoss Application Server) is available for the general use. JBoss blog has announced this new on Feb 11, 2014. Jason Greene, who is the lead for this project updates the features on this new release and providing the road map for the future releases. One of the key …
JPA – Lazy Loading and Eager Loading
Eclipselink 2.1 is a persistence provider runtime of the Java Persistence API 2.1 specification. JPA specification defines two major strategies of loading data (Lazy and Eager). The EAGER strategy is a requirement on the persistence provider runtime that data must be eagerly fetched. The LAZY strategy is a hint to the persistence provider runtime that …
JPA Entity Listeners And Callback Methods
Before JPA 2.1 the concept of Entity Listeners (Injectable EntityListeners) wasn’t defined until JPA 2.1 released. The entity listener concept allows the programmer to designate a methods as a lifecycle callback methods to receive notification of entity lifecycle events. A lifecycle callback methods can be defined on an entity class, a mapped superclass, or an entity …