Thursday, June 26, 2008

Java Messaging service ...

It was just by chance i came across an article on JMS and never knew it can be so useful in client - server application.

JMS helps us in implementation of distributed systems with efficiency. Following diagram explains the architecture of JMS.

Many of the other advantages of JMS include abstraction and system scaling but then it can lead to some complications too.

You can go through following url for more details on JMS.
http://www.javaworld.com/javaworld/jw-10-2002/jw-1025-jms.html?page=1

Wednesday, June 25, 2008

Java Break - Interview Questions Section

I am putting some common and not so common Interview questions here (Only related to core Java). This is going to be a great effort, to compile and write list of questions, so allow me to take my time.
I will initially add only questions, and as and when i get some time, I will also put answers. However, others are welcome to add answers. Needless to say, correct me if i go off the track.

This is going to be an ongoing effort and I promise to make this list bigger and as relevant as possible. This is going to be a fun...

Difference between Interface and Abstract class.


here goes the answer


What is autoboxing.


What is the difference between wait and sleep.


Explain valoatile modifier. How is it different to synchronize keyword?


Explain final, finally and finalize.


Whats the difference between yield , wait and sleep?

Tuesday, June 24, 2008

Java 6 feature - Scripting in Java

Other day i was reading some of the new features introduced in Java6 and one of the feature is that now java supports scripting. Some of the advantages listed on different sites were, such as providing extensions to your Java application so that users can write their own scripts to extend or customize the core functionalities. Scripting languages are both simpler to understand and easier to write, so they can be ideal to give (technical) end users the possibility to tailor your product to their needs. But, is it really a great thing? I still dont find (probably I am too lazy to search more on this topic and I hate Scripting as much as I know they are hard to avoid) a good good reason to have this feature in Java. Anybody?

References in java

Everyone knows about strong references in Java, few know about weak references as well. I was recently preparing for an interview and I wanted to read some more about weak references and found a really nice article about different types of references in Java. Well I was looking for 2 and i found 2 more , strong, weak, soft and phantom reference.

A very good article explaining different references , worth giving a look:
http://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html

Monday, June 23, 2008

Size of objects in java

We all know that there is no operator or method to calculate size of an object in java. But can't really understand the reason for it, i mean if c++ can have it then why not java?
Only way to calculate appox. size of an objects might be to find out all the primitive data types forming the object and then add up their byte size.

If anybody knws a better a way or knws more size calculations then comments are welcome ...