Monday, June 28, 2010

Need of abstract class and Interface.

Abstract class and Interface are used when there is a difference in behavior among the sub-types extending the abstract class or implementing the interface.

Need of abstract class :
when the sub-types behavior is partially common and different with respect to the super-type then use an abstract class .
Need of Interface :
When the sub-types behavior is totally different then you use an interface.

More clarification let me know :

Thursday, June 24, 2010

Avoid Deadlock.

Step to prevent Deadlock :

Live Example :

By synchronizing the methods of the kitchen class, we are essentially preventing more than one cook from
using the kitchen at a time; the purpose of having multiple threads is to allow more than one cook to use the
kitchen.

Deadlock Code :

Here you will get clear picture for Deadlock :

http://www.itec.uni-klu.ac.at/~harald/CSE/Content/deadlock.html

Wednesday, June 23, 2010

Difference between JDK 1.4 and JDK 1.5....?

Sun system added new feature in JDK 1.5 :
1.It's allowed to read Image like BMP and WBMP Image format this feature is not in JDK 1.4.
2.JTable able to support printing functionality that is not available in JDK 1.4.
2. JDK 1.5 support to import static like that import static java.lang.System.out; and we cant write only out.println("India"). This feature is not in JDK 1.4.
3.Generic feature in JDK 1.5 not in JDK 1.4.

For more clarification let me know...