Java Tricky Questions and Answers


Q) What is the output of the below program?
public class Test {
    public static void main(String[] args) {
        method(null);
    }
    public static void method(Object o) {
        System.out.println("Object impl");
    }
    public static void method(String s) {
        System.out.println("String impl");
    }
}
								

A) Object impl

B) String impl

C) Compilation Error

D) Runtime Error


 Answer:  Click here

Java document World PREVIOUS NEXT Java document World



















Publish Your Article


Receive Latest Java Examples in Your Email: