It's not a secret anymore!*
The moose likes Java in General and the fly likes Native Method in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Native Method in java" Watch "Native Method in java" New topic
Author

Native Method in java

Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 102

1. public final native Class getClass();
2. public native int hashCode();
I have taken these above two method from java.lang package . What is actual use "native"?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

It means that these methods are not implemented in Java itself, but in a platform-specific native library (a DLL if you're running on Windows).

You can use JNI (Java Native Interface) to call non-Java code from a Java program.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 102

What platform specific native library.?
Jesper de Jong wrote:It means that these methods are not implemented in Java itself, but in a platform-specific native library (a DLL if you're running on Windows).

You can use JNI (Java Native Interface) to call non-Java code from a Java program.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38042
    
  22
Google for open jdk and you can probably find the source code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Native Method in java
 
Similar Threads
native
native modifier
Native method
how many type or how many kind of way we can create an object in java??
native methods