File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Kathy-Bert book: question5 p.135 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Kathy-Bert book: question5 p.135" Watch "Kathy-Bert book: question5 p.135" New topic

Kathy-Bert book: question5 p.135

Danny Tran

Joined: Mar 02, 2003
Posts: 8
can somebody explain for me why in question 5 page 135 in Kathy-Bert programmer guide, the declaration no.5
private native void m1();
is a legal one???
is it an abstract method or if it is not, can it end with the semicolon ???
Many thanks
Sarma Lolla
Ranch Hand

Joined: Oct 21, 2002
Posts: 203
The method is declared as native. That means the implementation of the method is done in language like C. Compiler wouldn't verify any thing else on these native methods till the method is called from your code. At that time if the right library having this method is not linked you get a run time error. At compile time no checks for native methods.
Native methods can't have body. They should end with simply a semicolon.
I agree. Here's the link:
subject: Kathy-Bert book: question5 p.135
It's not a secret anymore!