Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Kathy-Bert book: question5 p.135

 
Danny Tran
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sarma Lolla
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic