Monday, August 31, 2009

JAVA Facts:

What are the differences between Abstract class and Interfaces?

Abstract classes allow code with implementations whereas interfaces does not contain code with  implementations.Abstract classes allow non abstract methods.Abstract classes allow constructors and instance variables whereas interfaces wont allow constructors and instance variables.

If a class contains methods which is declared abstract, then that whole class must be declared as abstract.
Abstract class is inherited from the class object and it contains some methods like clone(),equals().
Abstract class can have modifier i.e. visibility like protected,public,package(none), and private, whereas interfaces can have only two modifiers like public and package(none).




What are the differences between JNI and JNDI? 

 JNI stands for Java Native Interface, and it is completely different from JNDI which stands for Java Naming and Directory Interface. JNI allows the java programmer to invoke methods on programming languages like C++,small talk and many other non-java programming languages.JNDI on the other hand is the most important concept provided by J2EE.

J2EE components register their services to JNDI, after that applications can use the J2EE resources.
The "native" keyword is used to indicate that is from different language, and only methods can be declared as native , i.e. we cannot declare variables as native.JNDI consists of SPI(Service Provider Interface) which allows the various directory services to be plugged into the system.

No comments: