Created
November 22, 2017 11:25
-
-
Save alexandreaquiles/b687a1d258fb7f1d464ab8314f08a581 to your computer and use it in GitHub Desktop.
Warning when _ used as an identifier in Java 8. Compilation error in Java 9 (though, bytecode from Java 8 is executed).
This file contains hidden or 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
alexandre ~/keyword $ /usr/lib/jvm/java-8-oracle/bin/javac Keyword.java | |
Keyword.java:3: warning: '_' used as an identifier | |
int _ = 1; | |
^ | |
(use of '_' as an identifier might not be supported in releases after Java SE 8) | |
Keyword.java:4: warning: '_' used as an identifier | |
System.out.println(_); | |
^ | |
(use of '_' as an identifier might not be supported in releases after Java SE 8) | |
2 warnings | |
alexandre ~/keyword $ /usr/lib/jvm/java-8-oracle/bin/java Keyword | |
1 | |
alexandre ~/keyword $ /usr/lib/jvm/java-9-oracle/bin/java Keyword | |
1 | |
alexandre ~/keyword $ /usr/lib/jvm/java-9-oracle/bin/javac Keyword.java | |
Keyword.java:3: error: as of release 9, '_' is a keyword, and may not be used as an identifier | |
int _ = 1; | |
^ | |
Keyword.java:4: error: as of release 9, '_' is a keyword, and may not be used as an identifier | |
System.out.println(_); | |
^ | |
2 errors |
This file contains hidden or 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 Keyword { | |
public static void main(String[] args) { | |
int _ = 1; | |
System.out.println(_); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment