File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Groovy Fundamentals video training course this week in the Groovy 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: 106

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: 14827
    
  26

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 8 API documentation
Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 106

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: 42698
    
  32
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