wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reg. native methods " Watch "Reg. native methods " New topic

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 �
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
It is sorta covered in the JavaRanch Style Guide.
subject: Reg. native methods
Similar Threads
WA #1.....word association
most beautiful city
Populate Table Rows With Data from AJAX
Your native place and your working city