Wish to have some nice time? Check out what I'm reading online!

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:

Explain the scope of JSP objects.

Scope of JSP objects: The availability of a JSP object for use from a particular place of the application is defined as the scope of that JSP object. Every object created in a JSP page will have a scope. Object scope in JSP is segregated into four parts and they are page, request, session and application. page [...]

June 10th, 2008

Difference between Vector and ArrayList in java?

java.util.Vector came along with the first version of java development kit (JDK). java.util.ArrayList was introduced in java version1.2, as part of java collections framework. As per java API, in Java 2 platform v1.2,vector has been retrofitted to implement List and vector also became a part of java collection framework. All the methods of Vector is synchronized. [...]

June 4th, 2008

How many types of java variables are there?

Java variables can be categorized into the following seven types: Class Variable Instance Variable Array Component Variable Method Parameter Variable Constructor Parameter Variable Exception Handler Parameter Variable Local Variable 1) Class Variable A java class variable is a field declared using the keyword static within a java class, or with or without the keyword static within a java interface declaration. 2) Instance Variable Java variables that [...]

June 2nd, 2008

Explain the methods used for session tracking.

Following answer is applicable irrespective of the language and platform used. Before we enter into session tracking, following things should be understood. What is a session? A session is a conversion between the server and a client. A conversion consists series of continuous request and response. Why should a session be maintained? When there is a series of continuous [...]

May 31st, 2008

What is a java marker interface?

Java marker interface has no members in it. Marker interface ‘was’ used as a tag to informĀ a message to the java compiler. Java Marker Interface Examples: java.lang.Cloneable java.io.Serializable java.util.EventListener Lets take the java.io.Serializable marker interface. It doesnot has any members defined it it. When a java class is to be serialized, you should intimate the java compiler in some way [...]

May 29th, 2008

What happens if you call destroy() from init() in java servlet?

destroy() gets executed and the initialization process continues. It is a trick question in servlets interview. In java servlet, destroy() is not supposed to be called by the programmer. But, if it is invoked, it gets executed. The implicit question is, will the servlet get destroyed? No, it will not. destroy() method is not supposed to [...]

May 27th, 2008

Explain the Final Keyword in Java.

A java variable can be declared using the keyword final. Then the final variable can be assigned only once. A variable that is declared as final and not initialized is called a blank final variable. A blank final variable forces the constructors to initialise it. Java classes declared as final cannot be extended. Restricting inheritance! Methods declared as [...]

May 22nd, 2008

Access Modifiers In Java

Access modifiers specifies who can access them. There are four access modifiers used in java. They are public, private, protected, no modifer (declaring without an access modifer). Using ‘no modifier’ is also sometimes referred as ‘package-private’ or ‘default’ or ‘friendly’ access. Usage of these access modifiers is restricted to two levels. The two levels are [...]

May 22nd, 2008

How to avoid IllegalStateException in java servlet?

The root cause of IllegalStateException exception is a java servlet is attempting to write to the output stream (response) after the response has been committed. It is always better to ensure that no content is added to the response after the forward or redirect is done to avoid IllegalStateException. It can be done by including a [...]

May 19th, 2008

What is servlet mapping?

Servlet mapping specifies the web container of which java servlet should be invoked for a url given by client. It maps url patterns to servlets. When there is a request from a client, servlet container decides to which application it should forward to. Then context path of url is matched for mapping servlets. How is servlet [...]

May 14th, 2008