0

What is the output of the given Java code?

public class Test { public static void main(String[] args) { method(null); } public static void method(Object o) { System.out.println("Object method"); } public static void method(String s) { System.out.println("String method"); } }

23rd Nov 2021, 12:18 PM
Cāptaßn RÄza Mhr
Cāptaßn RÄza Mhr - avatar
1 Answer
+ 4
You can just run the code and see the output. It will be "String method".
23rd Nov 2021, 12:26 PM
Artem đŸ‡ș🇩
Artem đŸ‡ș🇩 - avatar