interface One { public void someMethod(); } public class One_impl implements One { public static void main(String a[]){ System.out.println("hello"); } public native void someMethod(); } the interface above is implemented but still leaving someMethod without code and also not making this class as abstract why?
Hi Payal, The keyword native is the reason why. When you use the native keyword you are telling the compiler that the implementation is external to java. The compiler only requires the class to be made abstract if it doesn't implement (or imply implementation) the interface method(s). Regards, Manfred.
Hi all: When you declare the method as native, you give the control to the OS to implement the code for that method.You will not get any compile time errors because the compiler assumes that the method is implemented in the OS dependent way. The Developer may later on use JNI (Java Native Inteface) to implement this method. Hope this helps, Sandeep SCJP2, OCSD(Oracle JDeveloper) OCED(Oracle Internet Platform)
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad: