Warning: Invalid argument supplied for foreach() in /home/customer/www/techndeck.com/public_html/wp-content/plugins/use-any-font/includes/functions/uaf_font_functions.php on line 469
Underscore is a 'KEYWORD' now since Java 9 - Techndeck

Underscore is a ‘KEYWORD’ now since Java 9

Since Java 9, the purpose of using ‘Underscore’ has been changed. With any version before Java 9, It can be used to create a variable or as an identifier. But, NO MORE. In Java 9, ‘Underscore’ is a keyword. In this article, we are going to see how it’s usage changed through various versions. 


Check out: Iterate / ofNullable operations in Java 9 Stream

Underscore is a KEYWORD now since Java 9...!!! Click To Tweet

Usage in Java 7

In Java 7, it could be used to used as an identifier or creating variable. Below code will compile & execute completely fine.



Usage in Java 8

In Java 8, Oracle developers added the warning message that will be displayed when we execute the below code. Below code will compile perfectly fine but will show the warning message on execution.



Usage in Java 9

In Java 9, ‘Underscore’ is a keyword therefore below code won’t compile and will throw the error message. 



Underscore is a KEYWORD now since Java 9...!!! Click To Tweet

Do you like this Post? – then check my other helpful posts:

Other Useful References:


Related Posts:

[wcp-carousel id=”5342″]

Promotional Content:

[wp_rss_retriever url=”https://justanordinarywriter.com/feed” items=”3″ excerpt=”30″ read_more=”true” credits=”true” new_window=”true” thumbnail=”100″ cache=”12 hours” orderby=”random”]

Leave a Reply

Your email address will not be published.Required fields are marked *

Facebook Twitter Instagram YouTube