10 JDK 7 Features to Revisit, Before You Welcome Java 8

It's been almost a month Java 8 is released and I am sure all of you are exploring new features of JDK 8. But, before you comp..

Already a Member? Log In to Your Account
This Blog Posts All Posts Directory Listings Articles

10 JDK 7 Features to Revisit, Before You Welcome Java 8

04/15/2014 09:13:00 AM

It's been almost a month Java 8 is released and I am sure all of you are exploring new features of JDK 8. But, before you completely delve into Java 8, it’s time to revisit some of the cool features introduced on Java 7. If you remember, Java 6

How to fix org.hibernate.MappingException: Unknown entity Exception in Java

04/12/2014 23:45:00 PM

If you have used Hibernate with JPA and using annotation to declare your entity bean then you might have seen this confusing error called "org.hibernate.MappingException: Unknown entity". This error message is so misleading that you could easily lose

Difference between FileInputStream and FileReader in Java | InputStream vs Reader

04/10/2014 08:38:00 AM

Before going to explain specific difference between FileInputStream and FileReader in Java, I would like to state fundamental difference between an InputStream and a Reader in Java, and when to use InputStream and when to go for Reader. Actually, Bot

For Each loop Puzzle in Java

04/09/2014 01:54:00 AM

From Java 5 onwards, we have a for-each loop for iterating over collection and array in Java. For each loop allows you to traverse over collection without keeping track of index like traditional for loop, or calling hasNext() method in while loop usi

Dealing with org.hibernate.LazyInitializationException: could not initialize proxy - no Session in Hibernate Java

04/06/2014 02:50:00 AM

If you are working in Hibernate framework, then you know that one of the key feature of Hibernate is "lazy initialization", which allows framework to lazily initialize dependencies, relationship or association lazily from database on need basis. For

How to replace line breaks , New lines from String in Java.- Windows, Mac or Linux

04/04/2014 10:02:00 AM

We often need to replace line terminator characters, also known as line breaks e.g. new line n and carriage return r with different characters. One of the common case is to replace all line breaks with empty space in order to concatenate multiple l

Difference between Stub and Mock object in Java Unit testing - JUnit

04/02/2014 08:51:00 AM

JUnit is the most popular framework for unit testing Java code. Unit testing is used to test a single programming unit e.g. a class or a method, in-fact many Java developer write unit test on per method basis. Stub and Mock objects are two concepts w

How to use EnumSet in Java with Example

03/31/2014 09:55:00 AM

EnumSet is one of the specialized implementation of Set interface for enumeration type, introduced in Java 1.5 along with enumeration type itself. Programmer often stores Enum into common collection classes e.g. HashSet or ArrayList, mostly because t

Hibernate NullPointerException due to Space in HQL named queries

03/29/2014 00:05:00 AM

If you are using Hibernate for implementing persistence layer in Java and JEE application from couple of years then you would have seen this notorious NullPointerException while executing HQL named queries, Exception in thread “main” java.lang.Nu

3 ways to Find First Non Repeated Character in a String - Java Programming Problem

03/27/2014 09:44:00 AM

Write a Java program to find first non repeated character in a String is a common question on coding tests. Since String is a popular topic in various programming interviews, It's better to prepare well with some well-known questions like reversi

Difference between WeakReference vs SoftReference vs PhantomReference vs Strong reference in Java

03/25/2014 09:53:00 AM

WeakReference and SoftReference were added into Java API from long time but not every Java programmer is familiar with it. Which means there is a gap between where and how to use WeakReference and SoftReference in Java. Reference classes are particu

Binary Search vs Contains Performance in Java List

03/21/2014 10:18:00 AM

There are two ways to search an element in a List class, by using contains() method or by using Collections.binarySearch() method. There are two versions of binarySearch() method, one which takes a List and Comparator and other which takes a List and

2 Examples of Streams with Collections in Java 8

03/19/2014 08:44:00 AM

Finally Java 8 is here, after more than 2 years of JDK 7, we have a much expected Java 8 with lots of interesting feature. Though Lambda expression is the most talked item of coming Java 8 release, it wouldn't have been this much popular, if Coll

How to Check if a Number is Binary in Java - Programming Problem

03/17/2014 08:35:00 AM

Today we will take a look on another simple programming exercise, write a program to check if a number is binary in Java. A number is said to be binary if it only contains either 0 or 1, for example 1010 is binary number but 1234 is not. You can not

Why use Underscore in Numbers from Java SE 7 - Underscore in Numeric Literals

03/13/2014 09:14:00 AM

JDK 1.7 release had introduced several useful features, despite most of them being syntactic sugar, there use can greatly improve readability and code quality. One of such feature is introduction of underscore in numeric literals. From Java 7 onwards

How to Clone Collection in Java - Deep copy of ArrayList and HashSet

03/11/2014 09:13:00 AM

Programmer often mistook copy constructors provided by various collection classes, as a mean to clone Collection e.g. List, Set, ArrayList, HashSet or any other implementation. What is worth remembering is that, copy constructor of Collection in Java

Top 10 MQ Series Interview Questions Answers - WebSphere and Active MQ

03/05/2014 07:32:00 AM

MQ Series Interview Questions and Answers are collection of some of the questions asked on various MQ implementation e.g. IBM WebSphere MQ, Active MQ or Sonic MQ from different core Java and Enterprise Java (JEE) interviews. Most of these questions a

Covariant Method Overriding of Java 5 - Coding Best Practices

03/03/2014 07:24:00 AM

Sometime knowledge of a specific Java feature can improve code quality, Covariant method overriding is one of such feature. Covariant method overriding was introduced in Java 5, but it seems it lost between other more powerful features of that releas

Why Catching Throwable or Error is bad?

02/28/2014 07:10:00 AM

We often hear advice that catching Throwable or Error is bad practice and Java developer should avoid catching these, but have you thought Why? If language allows you to catch anything which is instance of java.lang.Throwable, then what is the proble

10 Example of Lambda Expressions and Streams in Java 8

02/26/2014 08:22:00 AM

Java 8 release is just a couple of weeks away, scheduled at 18th March 2014, and there is lot of buzz and excitement about this path breaking release in Java community. One of feature, which is synonymous to this release is lambda expressions, which

How to Format and Display Number to Currency in Java - Example Tutorial

02/24/2014 06:58:00 AM

Displaying financial amount in respective currency is common requirement in Java based E-commerce applications. For example if you are selling products on-line globally, you will show price of product in their local currency rather than USD or some o

Fixing java.net.BindException: Cannot assign requested address: JVM_Bind in Tomcat, Jetty

02/21/2014 08:57:00 AM

Some of the most dreaded error in Java based client server based application is networking related error, e.g. java.net.BindException: Cannot assign requested address: JVM_Bind. I have faced this issue, while working with web servers like Tomcat, Jet

Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Experienced

02/19/2014 08:57:00 AM

In this article, I am sharing 30 core Java technical questions, from screening and phone round of interviews. In telephonic interviews, questions are short, fact based and Interviewer expects some keyword in answers. Accordingly, I have given very sh

How to Create Tabs UI using HTML, CSS, jQuery, JSP and JavaScript

02/17/2014 07:06:00 AM

JSP is still a popular technology for developing view part of Struts and Spring based Java application, but unfortunately it doesn't have rich UI support available in GWT, or any other library. On other day, we had a requirement to display HTML

Why Static Code Analysis is Important?

02/14/2014 07:00:00 AM

From last few years, Software code quality and security has went from being a “nice to have” to a necessity, and many organizations, including investment banks are making it mandatory to pass static code analysis test, penetration testing and sec

Display tag Pagination, Sorting Example in JSP and Servlet

02/11/2014 08:12:00 AM

If you are a Java programmer, writing JSP pages for your web application and doesn't know much about JavaScript, jQuery, CSS and HTML, then display tag is best for creating dynamic tables, pagination, sorting, and exporting data into PDF, Word an

Java Comparable Example for Natural Order Sorting

02/07/2014 21:50:00 PM

Java allows you to sort your object in natural order by implementing Comparable interface. It's one of the fundamental interface of Java API and defined in java.lang package, which means you don't need to implement this unlike its counterpart

Difference between Association, Composition and Aggregation in Java, UML and Object Oriented Programming

02/05/2014 09:52:00 AM

In Object-oriented programming, one object is related to other to use functionality and service provided by that object. This relationship between two object is known as association in  object oriented general software design, and depicted by an arr

StringTokenizer Example in Java with Multiple Delimiters

02/02/2014 01:20:00 AM

StringTokenizer is a legacy class for splitting strings into tokens. In order to break String into tokens, you need to create a StringTokenizer object and provide a delimiter for splitting string into tokens. You can pass multiple delimiter e.g. you

Top 5 Hibernate Books for Java Developers - Best, Must read

01/28/2014 08:09:00 AM

Hibernate is one of the most popular, open source ORM (Object Relational Mapping) framework, which has now become an standard for developing persistence layer on Java enterprise application, along with JPA (Java Persistence API). I often receive requ

Java Comparator Example for Custom Sorting Employee by Name, Age and Salary

01/24/2014 22:48:00 PM

In this tutorial, we will see Java Comparator example to sort an Employee object by name, age and salary. In order to sort Employee object on different criterion, we need to create multiple comparators e.g. NameComparator, AgeComparator and SalaryCom

10 Tips to Improve Programming Skill and become better Programmer, Developer

01/21/2014 08:52:00 AM

Many Java developers ask me How to become better programmer, how do I improve my programming skills, or I am good at Java but not so good on problem solving skill etc. This is reality, today's era is full of language expert than real programmers.

Eclipse Not Able To Connect Internet, Market Place - Configure Connection Proxy Settings

01/18/2014 07:14:00 AM

If you are using Eclipse in your company, you might have faced issues, where Eclipse is not able to connect to internet. Since most of companies uses proxy for connecting to Internet, its important to configure proxy settings in Eclipse to allow Ecli

Why Default or No Argument Constructor is Important in Java Class

01/15/2014 08:13:00 AM

Almost all Java developers knows that compiler adds a default constructor or better known as no argument constructor in every Java class, but many of them forget that, it only does when you don't provide any other constructor. Which means it beco

Why Java Certifications are Good for Freshers and Junior Developers?

01/11/2014 04:31:00 AM

I have seen many Java programmers in doubt whether to go for certifications or not? Should I go for OCPJP 7 or not, is a common doubt among young graduate and a Java developer with few years of experience under his belt. Well, getting certified and r

Top 5 Free Scala Programming Books for Java Programmers, Download as PDF or Read Online

01/08/2014 08:00:00 AM

Scala is another JVM based programming language, which is quickly gaining popularity because of its interesting mix of object oriented and functional programming paradigm. Many companies has started using Scala for there strategic and mission critica

How to Remove Objects from Collection or ArrayList in Java while Traversing - Iterator remove() method Example

01/06/2014 07:48:00 AM

How do you remove objects from Java collections like ArrayList, while iterating is one of the frequent questions my reader asked to me in my post about Top 25 Java Collection Interview Questions. Well, this question may seems quite easy, because eve

How to Remove Duplicates from Array without using Java Collection API

01/04/2014 00:32:00 AM

This is a coding questions recently asked to one of my reader in a Java Technical interview. Question was to remove duplicates from an integer array without using any collection API classes like Set or LinkedHashSet, which can make this task trivial.

Does Java Certifications like SCJP, OCJP or OCPJP helps in Job and Career?

01/01/2014 08:34:00 AM

First of all, Wish you very Happy New Year 2014 !!, May god brings success to you all. I receive lots of questions about usefulness of Java certifications like SCJP, now known as OCJP or OCPJP. Questions like, does doing Java Certification helps land

Inter Thread Communication in Java using Wait Notify Example

12/30/2013 06:43:00 AM

Wait and notify methods in Java are used for inter-thread communication i.e. if one thread wants to tell something to another thread, it uses notify() and notifyAll() method of java.lang.Object. Classical example of wait and notify method is Producer

How to redirect a page or URL using JavaScript and JQuery

12/25/2013 06:24:00 AM

Redirecting a web page means, taking user to new location. Many website use redirect for many different reasons, e.g. Some website redirect user from old domain to new domain, some redirect from one page to another e.g. a more relevant page. If you a

JUnit Testing Tips - Constructor is Called Before Executing Test Methods

12/19/2013 08:20:00 AM

Most of Java programmers either use JUnit or TestNG for there unit testing need, along with some mock object generation libraries e.g. Mockito, but not everyone spend time and effort to learn subtle details of these testing libraries, at least not in

How to configure Log4j in Java program without XML or Properties File

12/12/2013 08:18:00 AM

Sometime configuring Log4j using XML or properties file looks annoying, especially if your program not able to find them because of some classpath issues, wouldn't it be nice if you can configure and use Log4j without using any configuration file

When to make a method final in Java

12/04/2013 08:40:00 AM

Final keyword in Java is not as mysterious as volatile or transient, but still it creates lot of doubts on programmers mind. I often receives questions like, When to make a method final in Java or When to make a method static in Java, later I answere

© 2006-2014 OnToplist.com, All Rights Reserved