This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reg. native methods

 
Angela Narain
Ranch Hand
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the below declaration valid :
public static native void methodA() ;
 
Gagan Indus
Ranch Hand
Posts: 346
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes , native methods can be static
( they can never be abstract )
------------------
Gagan (/^_^\)
 
Angela Narain
Ranch Hand
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are nt' native methods by default abstract ?
 
Amit Agrawal
Ranch Hand
Posts: 282
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no they are not [abstract].
 
Jane Griscti
Ranch Hand
Posts: 3141
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Angela,
'abstract' tells the compiler the method isn't implemented by the class and must be implemented by any subclasses.
'native' tells the compiler that the method does not require implementation because it will be available from the operating system. In other words, it's not 'abstract', it is implemented, just not in Java.
You'll get a compile error if you declare a method to be both 'native' and 'abstract'. See JLS �8.4.3.4
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
[This message has been edited by Jane Griscti (edited September 15, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic