Last active
August 29, 2015 14:03
-
-
Save ALRubinger/e14a3f905561f9015575 to your computer and use it in GitHub Desktop.
Java Puzzler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NullVarArgs { | |
public static void main(String... args) { | |
// 1 | |
exec(null); | |
// 2 | |
exec((String) null); | |
// 3 | |
final String s = null; | |
exec(s); | |
} | |
private static void exec(String... args) { | |
System.out.println(args); | |
} | |
} |
qmx
commented
Jun 26, 2014
Warning:(8, 14) java: non-varargs call of varargs method with inexact argument type for last parameter;
cast to java.lang.String for a varargs call
cast to java.lang.String[] for a non-varargs call and to suppress this warning
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment