Java Blog

This is my blog on java, servlets, JSP and design patterns. This might help you to keep your java knowledge updated and also to prepare for your java interview, sun java certification. Its all there, it is left to you how to use it! I started this blog with a selfish reason, just to keep my java knowledge updated and to keep log of the questions that arise in my mind. Now it has turned out to be a full blown java tutorial site with lots of java interview questions and articles. Good day!

Recent Java Articles:

Type Erasure

Java generics uses Types. If you are not still using java generics, following example code explains you a simple generics usage: package com.javapapers.sample; import java.util.HashMap; import java.util.Map; public class TypeErasure { public static void main(String args[]) { Map<String, String> languageMap = new HashMap<String, String>(); languageMap.put("1954", "FORTRAN"); languageMap.put("1958", "LISP"); languageMap.put("1959", "COBOL"); String language = languageMap.get("1954"); System.out.println("Our favourite language is "+language); } } In the above code, we instantiate a map [...]

July 27th, 2010

Getting Started with AJAX using Java

AJAX is an acronym for Asynchronous JavaScript And XML. AJAX provides an ability to communicate with the server asynchronously. Here asynchronous is the keyword. To explain that in simple terms, you can send a request to server and continue user interaction with the user. You need not wait for response from the server. Once the [...]

July 21st, 2010

JAG is Now Unemployed!

I recently noticed that James Gosling moved his blog from sun’s site to his own blog with a cool domain name. Also, I noticed in his bio that he is unemployed. Yes, you read it right, James Gosling is unemployed! Oracle bought Sun some time back. We are all eagerly watching the events aftermath. I [...]

July 15th, 2010

Prototype Pattern

When creating an object is time consuming and a costly affair and you already have a most similar object instance in hand, then you go for prototype pattern. Instead of going through a time consuming process to create a complex object, just copy the existing similar object and modify it according to your needs. Its a [...]

July 14th, 2010

Address of a Java Object

In conventional java programming, you will never need address or location of a java object from memory. When you discuss about this in forums, the first question raised is why do you need to know the address of a java object? Its a valid question. But always, we reserve the right to experiment. Nothing is [...]

July 5th, 2010

Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency

These terms signify the relationships between classes. These are the building blocks of object oriented programming and very basic stuff. But still for some, these terms look like Latin and Greek. Just wanted to refresh these terms and explain in simpler terms. Association Association is a relationship between two objects. In other words, association defines the multiplicity [...]

June 26th, 2010

Java’s toLowerCase() has got a surprise for you!

Have you ever encountered a surprise while using toLowerCase()? This is a widely used method when it comes to strings and case conversion. There is a nice little thing you should be aware of. toLowerCase() respects internationalization (i18n). It performs the case conversion with respect to your Locale. When you call toLowerCase(), internally toLowerCase(Locale.getDefault()) is [...]

May 9th, 2010

Is Your Java Code Privileged?

The java system code that is part of the JDK is considered God and has all the maximum privileges. For example it can read a system property by default. To easily understand it is better to consider java Applets. An Applet cannot read a system property by default because it belongs to different CodeSource and [...]

March 22nd, 2010

Now the SUN is Red

sun.com now redirects to oracle.com – oracle completes acquisition of sun. Is it a happy news or sad news for sun customers? In particular java guys. Oracle is a strong supporter of Eclipse – what will happen to NetBeans now? Will oracle continue and endorse JCP (Java Community Process)? Will MySQL development continue? Will oracle continue OpenOffice? Will Glassfish live in [...]

January 30th, 2010

Serialize / De-Serialize Java Object From Database

In recent days generalization have become popular in software development. You build a common platform and generate applications out of it to reduce the cost. In such applications an activity that will be frequently performed is serializing java objects to database. There are many fancy tools and framework available to do this. Before using all of [...]

January 9th, 2010