Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Native Method Structure

 
Thomas Hauck
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following method

native void format();

appears to have the structure of an abstract method.

It compiles in both
1) abstract


and
2) non-abstract classes.


I understand that native methods are used to allow native code written in C or C++ to communicate with Java Code.

For the purposes of the exam,
I understand that this is a valid declaration.

native void format();


Methods that are preceded by the native modifier can have the method body of an abstract method without being declared abstract.

This method structure lies somewhere between

1) a concrete class with a method body

2) an abstract class with no method body

Question:
Does the native method receive its body after its interaction with native code ( for example code written in C++) has been written?


 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas Hauck wrote:I understand that native methods are used to allow native code written in C or C++ to communicate with Java Code.

For this exam you don't need to know more than that. I even think you just need to know it's a valid keyword, don't even know if you need to know the signature of a native method.

If you really want to know more about native methods, have a look here (warning: it's very advanced stuff).

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic