• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Can any one solve this

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public final static native int w();
is the following declaration correct In one of the mock paper it is given as valid declaration plz help me...
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A "native" method invokes a non-Java implementation, and therefore requires no braces. A native library is loaded via System.loadLibrary() and must be available to the JVM at runtime. Use of native methods generally makes the program platform-specific.

And that's about as much as you need to know about "native" for the SCJP. Does that clear it up?
[ January 09, 2006: Message edited by: marc weber ]
 
Lalit mishra
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But here the method is defined as final so can we still define the method some were else
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A final method cannot be overridden.

An abstract method defers implementation to a subclass, so an abstract method cannot be final.

But a native method is not abstract. Instead of deferring implementation to a subclass, a native method goes elsewhere (a native library) for its implementation.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes thats true.
The only thing u shud remeber is being native means we are providing the alternate implementation and else is immmaterial.
Assume some thing like this if the method implementation is provided the remaining signature public static final void is legal declaration..

Correct me if i am wrong

--Santosh
 
Get out of my mind! Look! A tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic