• 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

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic