• 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

wait,notify,notifyAll R they native ???

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Velmurugan's notes(excellent notes,i must say) say getClass,wait ,notify and notifyAll are final(fine) but also native.
(I know what native means.)So are they not written in java.Somebody please tell me something more about this.
BTW ,that they are native is not written in java 2 platform SE v1.3.1 documentation.How did he know that??
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A native method is declared in Java but then hooked into a local library of native code (C/C++) that does the real work. The specification that describes how this is done is known as JNI (Java Native Interface).
In short, a class with one or more native methods in it gets run through a code generator, which exports a C struct. Using that struct, the programmer hooks in a shared object library that performs whichever function is declared. Java code that wants to make use of the native method then uses a static initializer to load that library. The native method is thus a proxy for a local library call.
If you have the src.jar for your current JDK, you can examine the source for Object.java to see this declaration "in action":

You're right about the native keyword not showing up in the documentation. Check out this link. It explains that the native keyword isn't incorporated into javadoc as of JDK 1.2.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
[This message has been edited by Michael Ernest (edited September 01, 2001).]
 
leena rane
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx a lot sir,
I am very very happy to have got reply from one of my favourite authors - Michael Ernest - the author of the the best book that i found for SCJP.Now I am going to study with twice vigour and interest.Now i like javaranch even more,if my favourite author has replied me.
When the expert has answered ,links are not required,but sir i just got lost with the link u gave me.
Also i would like to ask one more thing,if things which are not in documentation come in exam(e.g. without velmurugan' notes i would not even have known that they are native),how do i answer??
And if i get a question which doesn't have the right answer,what am i supposed to do??
Thanx a lot again for replying me,
leena.
reply
    Bookmark Topic Watch Topic
  • New Topic