Monday, 17 August 2009

Java Certification Question 0067

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



Answer 4) Compilation and execution without error

It would cause a run time error if you had a call to amethod though.

No comments:

Post a Comment