hi, 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 danny.
posted 14 years ago
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.