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:
In java, a frequent occurence of a common phenomenon related to memory management is creation and destruction of temporary objects. What are java temporary objects? For example in java, when two strings are concatenated, a StringBuffer object is created. As two Java String objects cannot be added directly (immutable property), a helper object StringBuffer is [...]
July 17th, 2008
First lets understand what does “java import” does to your java program!
Consider the java import statements:
1) import package.ClassA;
2) import package.*;
Java statement (1) gives you a license to use ClassA inside the whole program without the package reference. That is you can use like ClassA obj = new ClassA(); or ClassA.getStatic(); Java statement (2) allows you [...]
June 14th, 2008
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
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
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
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
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
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
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 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