• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Native Method Structure

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?


 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

reply
    Bookmark Topic Watch Topic
  • New Topic