Archive

Archive for the ‘Java’ Category

What is a Java annotation?

October 15, 2012 Leave a comment

Ahhh… always had this question.
Consider the class below:

In this class, @ManagedBean and @SessionScope are annotations.

An annotation is nothing but a markup. That’s all….

But aren’t annotations interfaces? That’s what Google says.

So yes they are interfaces… Sun merely picked an interface cause developers at that time were aware of interfaces. Note that some annotations take affect at compile time and some at runtime (dictated by the retention policy of that annotation). So this is what happens when an annotation is encountered….

  1. An annotation is always processed by the respective container… this container could be a Spring container (if it is a Spring annotation), JSF container (if it is a JSF annotation), Hibernate container (if it is a Hibernate annotation) and so on. And Java itself if it is a Java annotation.
  2. The container has something called as an annotation processor. This processor scans the code before it runs. So it is the annotation processor does the actions associated with the annotation. The annotation processor has all the intelligence. So if you have two annotations on a class and the annotation processor expects one to be before the other, you will get an error (not sure if it is runtime or compilation time.)
Categories: Java

An awesome ANT tutotial…

October 8, 2012 Leave a comment
Categories: Java, Programming

Java Generics.

March 12, 2012 Leave a comment
Categories: Java, Programming

Core Java Understanding.

November 7, 2011 Leave a comment

There are three main things in Java.

  1. The JVM: This is the Java Virtual Machine. Now the deal is that this is an abstract concept.
  2. The JRE: This is the actual implementation of the JVM. You thus have a JRE for Windows, Linux, Mac etc.
  3. The JDK: This is the JRE + other stuff needed to program in Java. For instance, there is the Java Complier, the Debugger, the Profiler etc.
Categories: Java, Programming

Java JAR Tutorial

September 22, 2011 Leave a comment

Java JAR Tutorial link.

Categories: Java

JCA vs JMS vs Web Services

September 15, 2011 Leave a comment
Categories: Java