What is the output of the given Java code? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Resposta
+ 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