Java Tutorials, Tips & Tricks
Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun Microsystems’ Java. It is platform independent.
Java Collection API is one of the most useful APIs used in any Java application. In my day to day Java coding routine, I have to deal with these APIs quite often.However sometime while working with Collection API, lot of developers end up writing unnecessary and mostly inefficient code. For example, to convert an Java ...
Nowadays, Quick Response (QR) Codes are becoming more and more useful as they have gone mainstream, thanks to the smart phones. Right from the bus shelter, product packaging, home improvement store, automobile, a lot of internet websites are integrating QR Codes on their pages to let people quickly reach them. With increase in number of users of smart phones day by day, the QR codes ...
In this tutorial we will write a CRUD application in Hibernate using Java 5 Annotation. For this we will use our previous tutorial
Hibernate Maven MySQL hello world example (XML Mapping) as base and convert it from XML Mapping to Annotation.Tools and Technologies used:Java JDK 5 or above Eclipse IDE 3.2 or above Maven 3.0 or above Hibernate 3.0 or above MySQL 5.0 or above1. Database CreationFor ...
JavaServer Tag library is one of the most used JSP tag library out there. I have used it almost in all of my JEE based projects. The best feature probably is the Iterator API in JSTL tag library.Here is a small code snippet which you might not know. Its very easy to iterate Lists using JSTL. For example://Java List<String> cityList = new ArrayList<String>(); cityList.add("Washington DC"); cityList.add("Delhi"); cityList.add("Berlin"); cityList.add("Paris"); cityList.add("Rome");request.setAttribute("cityList", cityList);//JSP <c:forEach ...
After reading the excellent article titled
Saving/Retreving BLOB object in Spring MVC/Hibernate immediately came to my mind:How would it be the process of recreating the same example but using Spring Roo. What would it be the similarities/differences in the projects source code.The article assumes the Reader is a Developer with some familiarity with Spring Roo. For introductory information about Spring ...
While working with Doubles and Long numbers in Java you will see that most of the value are displayed in Exponential form.For example : In following we are multiplying 2.35 with 10000 and the result is printed.//Division example Double a = 2.85d / 10000; System.out.println("1) " + a.doubleValue());//Multiplication example a = 2.85d * 100000000; System.out.println("2) " + a.doubleValue());Result:1) 2.85E-4 2) 2.85E8Thus you can see the result is ...
Recently while working in one of the requirement, I had to convert String values to Enum. I didn't realize there is a simplest way of doing this. Here is the solution.Whenever an ENUM is complied in Java, two static methods are added by compiler called valueOf() and values(). We can use valueOf() method to convert any String value to ENUM. For example lets say we ...
While using Maven as build tool in our project, I found it very difficult to create a Dynamic Web Project which supports
Maven dependencies and can execute in Eclipse! I have seen lot of people using Maven just as build tool and for local setup uses jar files in some /lib directory. I wanted to remove this dependencies on local /lib for jar files ...
As a Java developer, lot of times I have to play around with file system. Sometimes I have to copy files/directories from one location to another; sometimes have to process certain files depending on certain pattern. In one of my test program, I wanted to calculate available disk space using Java. Lot of code snippets are ...
Here is a small but very useful tip that every Java programmer should be aware of. Have you ever tried sorting arrays in Java? Well, java.util.Arrays class has built in method to make your job easy. You can use following method to sort any array in Java.import java.util.Arrays; ... ... Arrays.sort (int ) Arrays.sort (float ) Arrays.sort (long ) ...Let us check an example were we will sort an array of ...