{"id":26694,"date":"2015-09-15T11:00:40","date_gmt":"2015-09-15T05:30:40","guid":{"rendered":"https:\/\/2thenew.online\/blog\/?p=26694"},"modified":"2015-09-15T13:08:59","modified_gmt":"2015-09-15T07:38:59","slug":"why-you-should-stop-using-underscore-as-variable-name-in-java","status":"publish","type":"post","link":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/","title":{"rendered":"Why you should stop using underscore as variable name in Java"},"content":{"rendered":"<p>There is a programming practice in many languages that if in a function call you don&#8217;t care about the variable&#8217;s value then use _ to denote this. This convention is usually used where lambdas are used.<\/p>\n<p>Some people may be using this in Java also. If you are using it then you should stop. You must be asking why? Simply because underscore has been reserved for future use starting from JDK\u00a08.\u00a0Suppose you have the below<\/p>\n<div><\/div>\n<div>\n<p>[code]<br \/>\nvoid someMethod(int _) {<br \/>\n  \/\/ Something<br \/>\n}<br \/>\n[\/code]<\/p>\n<\/div>\n<div><\/div>\n<p>The above will give warning under JDK8 and as part of upcoming JDK 9 release this will become a compiler error. This is not a tentative change. It has been <a href=\"https:\/\/bugs.openjdk.java.net\/browse\/JDK-8061549\">implemented<\/a> in JDK9 under <a href=\"http:\/\/openjdk.java.net\/jeps\/213\">JEP 213 &#8211; Milling Project Coin<\/a>. If you have many places where you are using _ as a convention then all of that will break.<\/p>\n<p>Using underscore in a variable like a_b is still valid. But using _ alone as variable name is no more valid.<\/p>\n<p>You have been warned.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is a programming practice in many languages that if in a function call you don&#8217;t care about the variable&#8217;s value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You [&hellip;]<\/p>\n","protected":false},"author":161,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":21,"footnotes":""},"categories":[446,1],"tags":[2369,2370],"class_list":["post-26694","post","type-post","status-publish","format-standard","hentry","category-java","category-technology","tag-using-underscore","tag-variable-name-in-java"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"There is a programming practice in many languages that if in a function call you don&#039;t care about the variable&#039;s value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Aseem Bansal\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Why you should stop using underscore as variable name in Java | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"There is a programming practice in many languages that if in a function call you don&#039;t care about the variable&#039;s value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Why you should stop using underscore as variable name in Java | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"There is a programming practice in many languages that if in a function call you don&#039;t care about the variable&#039;s value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#article\",\"name\":\"Why you should stop using underscore as variable name in Java | TO THE NEW Blog\",\"headline\":\"Why you should stop using underscore as variable name in Java\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/aseem\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2015-09-15T11:00:40+05:30\",\"dateModified\":\"2015-09-15T13:08:59+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":3,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#webpage\"},\"articleSection\":\"Java\\\/JVM, Technology, using underscore, variable name in Java\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#listItem\",\"name\":\"Why you should stop using underscore as variable name in Java\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#listItem\",\"position\":3,\"name\":\"Why you should stop using underscore as variable name in Java\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/aseem\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/aseem\\\/\",\"name\":\"Aseem Bansal\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/03a78885-df21-4ce3-90c6-53a8b330984c_1376-Aseem-Bansal-PROFILEPICTURE.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Aseem Bansal\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/\",\"name\":\"Why you should stop using underscore as variable name in Java | TO THE NEW Blog\",\"description\":\"There is a programming practice in many languages that if in a function call you don't care about the variable's value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/why-you-should-stop-using-underscore-as-variable-name-in-java\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/aseem\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/aseem\\\/#author\"},\"datePublished\":\"2015-09-15T11:00:40+05:30\",\"dateModified\":\"2015-09-15T13:08:59+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Why you should stop using underscore as variable name in Java | TO THE NEW Blog","description":"There is a programming practice in many languages that if in a function call you don't care about the variable's value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You","canonical_url":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#article","name":"Why you should stop using underscore as variable name in Java | TO THE NEW Blog","headline":"Why you should stop using underscore as variable name in Java","author":{"@id":"https:\/\/2thenew.online\/blog\/author\/aseem\/#author"},"publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"},"datePublished":"2015-09-15T11:00:40+05:30","dateModified":"2015-09-15T13:08:59+05:30","inLanguage":"en-US","commentCount":3,"mainEntityOfPage":{"@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#webpage"},"articleSection":"Java\/JVM, Technology, using underscore, variable name in Java"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.online\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.online\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#listItem","name":"Why you should stop using underscore as variable name in Java"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#listItem","position":3,"name":"Why you should stop using underscore as variable name in Java","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.online\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.online\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.online\/blog\/author\/aseem\/#author","url":"https:\/\/2thenew.online\/blog\/author\/aseem\/","name":"Aseem Bansal","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/03a78885-df21-4ce3-90c6-53a8b330984c_1376-Aseem-Bansal-PROFILEPICTURE.jpeg","width":96,"height":96,"caption":"Aseem Bansal"}},{"@type":"WebPage","@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#webpage","url":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/","name":"Why you should stop using underscore as variable name in Java | TO THE NEW Blog","description":"There is a programming practice in many languages that if in a function call you don't care about the variable's value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.online\/blog\/author\/aseem\/#author"},"creator":{"@id":"https:\/\/2thenew.online\/blog\/author\/aseem\/#author"},"datePublished":"2015-09-15T11:00:40+05:30","dateModified":"2015-09-15T13:08:59+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.online\/blog\/#website","url":"https:\/\/2thenew.online\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Why you should stop using underscore as variable name in Java | TO THE NEW Blog","og:description":"There is a programming practice in many languages that if in a function call you don't care about the variable's value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You","og:url":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/","og:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Why you should stop using underscore as variable name in Java | TO THE NEW Blog","twitter:description":"There is a programming practice in many languages that if in a function call you don't care about the variable's value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You","twitter:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"26694","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 13:55:37","updated":"2024-02-29 08:58:24","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWhy you should stop using underscore as variable name in Java\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.online\/blog"},{"label":"Technology","link":"https:\/\/2thenew.online\/blog\/category\/technology\/"},{"label":"Why you should stop using underscore as variable name in Java","link":"https:\/\/2thenew.online\/blog\/why-you-should-stop-using-underscore-as-variable-name-in-java\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/26694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/users\/161"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/comments?post=26694"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/26694\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/media?parent=26694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/categories?post=26694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/tags?post=26694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}