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:

Session Life Cycle

Frog Life Cycle
When I say life cycle, I can hear you murmur “Oh no not again, how many life cycles I have to deal with”! In real world everything has life cycle, then why not in programming, after all, software is all about mimicking real life.  In a previous article I discussed about methods used for session [...]

September 24th, 2009

How to pre-compile JSP?

Add jsp_precompile as a request parameter and send a request to the JSP file. This will make the jsp pre-compile. Why it is mentioned as pre compile instead of compilation is that, the request is not served. That is, the JSP will not be executed and the request will not be serviced. Just it will [...]

May 21st, 2009

NullPointerException, null – Bad, good and ugly

NullPointerException: An attempt was made to use a null reference in a case where an object reference was required. NullPointerException is more famous to Java programmers, than fashion to Paris. When you start breaking the beurette and Pipette in Java lab, first thing you will get is NullPointerException. In this tutorial lets discuss about, do we [...]

May 14th, 2009

Differentiate JVM JRE JDK JIT

Diagram to show the relations between JVM JRE JDK
Java Virtual Machine (JVM) is an abstract computing machine. Java Runtime Environment (JRE) is an implementation of the JVM. Java Development Kit (JDK) contains JRE along with various development tools like Java libraries, Java source compilers, Java debuggers, bundling and deployment tools. JVM becomes an instance of JRE at runtime of a java program. It is [...]

May 10th, 2009

Servlet JSP Communication

getServletConfig().getServletContext().getRequestDispatcher(“jspfilepathtoforward”).forward(request, response); The above line is essence of the answer for “How does a servlet communicate with a JSP page?” When a servlet jsp communication is happening, it is not just about forwarding the request to a JSP from a servlet. There might be a need to transfer a string value or on object itself. Following is a [...]

April 8th, 2009

What are the causes of exceptions in java?

A java exception can be thrown only in the following three scenarios: (1) An abnormal execution condition was synchronously detected by the Java virtual machine. - When evaluation of an expression violates the normal semantics (Example: an integer divide by zero) - An error occurs in loading or linking part of the program - When limitation on a resource [...]

October 15th, 2008

Explain type of exceptions or checked vs unchecked exceptions in java.

Type of exceptions in java are checked exceptions and unchecked exceptions. This classification is based on compile-time checking of exceptions. There is also a classification based on runtime in java. It is not widely known! That is synchronous and asynchronous exceptions. First let us see the java checked exceptions and unchecked exceptions. Checked Exceptions Vs Unchecked [...]

October 14th, 2008

Explain the java this keyword.

This definition: Java’s ‘this’ keyword is used to refer the current instance of the method on which it is used. Following are the ways to use this 1) To specifically denote that the instance variable is used instead of static or local varible.That is, private String javaFAQ; void methodName(String javaFAQ) { this.javaFAQ = javaFAQ; } Here this refers to the instance variable. Here [...]

August 29th, 2008

Is javadoc comment a type of standard java comment?

How many types of java comments are there? Everybody knows there are two types of java comments available. Now the misunderstood part starts. What are those two types of java comments? The (§3.7) Java Language Specification Third Edition says, Traditional Comment End of line Comment What happened to the documentation comment or javadoc comment? No it is not a type [...]

July 23rd, 2008

Check list for Internationalization (I18n)

This check list for Internationalization (I18n) will cater to the need of programmers irrespective of the language java /dot net/ j2ee / any other. Translatable items GUI – Labels and Menu items User messages including third party component generated Log / system generated messages Help – Online help / manual and other deliverable documentation Installation notes [...]

July 20th, 2008