Hi,
I have a question about the one of the question from Marcus Green mock test 2.
What will happen when you attempt to compile and run this code?
public class Mod
{
public static void main(String argv[]){}
public static native void amethod();
}
1) Error at compilation: native method cannot be static
2) Error at compilation native method must return value
3) Compilation but error at run time unless you have made code containing native amethod available
4) Compilation and execution without error
As far as I know..none of these answers are correct as looking at method "amethod" in the above code, it should be declared abstract (ends with ()
and hence class shuld be declared abstract.
The answer given is 4.
Please let me know your views.
Thanks
-Prakash