This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Reg. native methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reg. native methods " Watch "Reg. native methods " New topic
Author

Reg. native methods

Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
Is the below declaration valid :
public static native void methodA() ;
Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
yes , native methods can be static
( they can never be abstract )
------------------
Gagan (/^_^\)


Gagan (/^_^\) SCJP2 SCWCD IBM486 <br />Die-hard JavaMonk -- little Java a day, keeps you going.<br /><a href="http://www.objectfirst.com/blog" target="_blank" rel="nofollow">My Blog</a>
Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
Are nt' native methods by default abstract ?
Amit Agrawal
Ranch Hand

Joined: Aug 23, 2001
Posts: 282
no they are not [abstract].
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
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).]


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reg. native methods
 
Similar Threads
most beautiful city
eclipse
WA #1.....word association
Populate Table Rows With Data from AJAX
Your native place and your working city