What is the difference between native and abstract

What is the difference between native and abstract?
can we declare a method as native inside an interface?if yes then why? if no then why not?

Showing Answers 1 - 3 of 3 Answers

Mallikarjuna

  • Sep 20th, 2006
 

Hi,

Native keyword is user to execute external code (c,C++) in java.

 

  Was this answer useful?  Yes

Sunil Pratap Singh

  • Nov 14th, 2006
 

Native keyword is prefixed with method name when we want that method to be implemented using a native language like c and c++. So in the class we only declare the method and the defination of the method is in the dll file.

Abstract key word is used to mark a method or a class as logically incomplete. The class which extends this class has to provide the defination of the method or has to declare the derived class as abstract.

We can not declare a native method inside a interface because by declaring a method in an interface we want all the implementers to give definations to the methods defined.But by declaring a method native we mean that the implementation will come from some native language.

  Was this answer useful?  Yes

No, because interface is by default is a abstract class and can contain only abstract methods and final or static variables, thus it cannot contain concrete methods and instant variables.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions