Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

abstract Interface  RSS feed

 
Aamir Khan
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how a interface can be abstract???see the javax.ejb package and there is an interface like that
public abstract interface EJBObject
extends java.rmi.Remote
can any one explain what does it mean
Aamir
[This message has been edited by Aamir Khan (edited November 07, 2000).]
 
Chitra Sundaram
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The signature for EJBObject is just
public interface EJBObject extends java.rmi.Remote.
Please check this site http://java.sun.com/j2ee/j2sdkee/techdocs/api/javax/ejb/EJBObject.html.

Chitra
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An abstract class is one which can not be created, but must be extended first. An abstract interface is one which can not nbe implemented, but must be extended first. Consider the following example:
 
Aamir Khan
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frank , I got it now.
Aamir
 
Naveen Chandra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frank, Sorry to say that you are worng.
Look at this program
abstract interface B{
public void doB();
}
interface C{
public void doC();
}
public class A implements B,C{
public void doB(){
System.out.println("I am B");
}
public void doC(){
System.out.println("I am C");
}
public static void main(String arg[]){
A ob = new A();
ob.doB();
ob.doC();
}
}
This program works perfectly fine.
As per the java language specs 9.1.2.1
Every interface is implicitly abstract and this modifier is
obsolete and should not be used in new Java programs.
I executed the above example using jdk1.2
Thanks,
Naveen.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!