• Post Reply Bookmark Topic Watch Topic
  • New Topic

Native key word  RSS feed

 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends
As we know native is the key word used in java .but when we go through the Object class in lang package they had written public native int hashCode();.
They had not implemented the method ,who will generate the hash code ?whether OS or the JVM will take care .
Native means to access code written in another language..... who will take care of this..
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code has been written in another language, probably C or C++, and is part of the JVM itself.
 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
who will generate the hash code ?whether OS or the JVM will take care

Please answer this point
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM will create the hash code. It may have a little help from the OS, but the JVM is responsible in the end.
 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks rob
As you told that native is used to talk with other code written in another language .then as your discussion JVM will call the native code written in operating system.and hence generates the hash code .... is it right
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might have to download a JVM source and read the code to work out that question. It might be different on a Sun JVM from an IBM JVM and might be different on Windows from Linux. I don't know.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!