{"id":69436,"date":"2017-10-06T10:00:03","date_gmt":"2017-10-06T07:00:03","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=69436"},"modified":"2017-10-06T09:51:21","modified_gmt":"2017-10-06T06:51:21","slug":"java-variables","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html","title":{"rendered":"Java Variables"},"content":{"rendered":"<h2>Variables<\/h2>\n<p>The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional initializer. In addition, all variables have a scope, which defines their visibility, and a lifetime. These elements are examined next.<\/p>\n<h3>Declaring a Variable<\/h3>\n<p>In Java, all variables must be declared before they can be used. The basic form of a variable declaration is shown here:<\/p>\n<blockquote>\n<p><i><br \/>\ntype identifier [ = value][, identifier [= value] &#8230;] ;<\/i><\/p>\n<\/blockquote>\n<ul>\n<li>The type is one of Java\u2019s atomic types (Data Types), or the name of a class or interface. (We will discussed about Class and interface types later ).<\/li>\n<li>The identifier is the name of the variable.<\/li>\n<li>You can initialize the variable by specifying an equal sign and a value. Keep in mind that the initialization expression must result in a value of the same (or compatible) type as that specified for the variable.<\/li>\n<li>To declare more than one variable of the specified type, use a comma separated list.<\/li>\n<\/ul>\n<h3>Example<\/h3>\n<blockquote>\n<p><i><br \/>\nint a, b, c; \/\/ declares three ints, a, b, and c.<\/i><\/p>\n<p>int d = 3, e, f = 5; \/\/ declares three more ints, initializing \/\/ d and f.<\/p>\n<p>byte z = 22; \/\/ initializes z.<\/p>\n<p>double pi = 3.14159; \/\/ declares an approximation of pi.<\/p>\n<p>char x = &#8216;x&#8217;; \/\/ the variable x has the value &#8216;x&#8217;.<\/p>\n<p>boolean d = false;\u00a0 \u00a0\/\/ boolean value initialized with value false;<\/p>\n<\/blockquote>\n<p>The identifiers that you choose have nothing intrinsic in their names that indicates their<\/p>\n<p>type.<\/p>\n<h3>Dynamic Initialization<\/h3>\n<p>Although the preceding examples have used only constants as initializers, Java allows variables to be initialized dynamically, using any expression valid at the time the variable is declared. Example Program for Dynamic variable Initialization:<\/p>\n<pre class=\"brush:java\">class DynInit {\r\npublic static void main(String args[]) {\r\ndouble a = 3.0, b = 4.0;\r\n\/\/ c is dynamically initialized\r\ndouble c = Math.sqrt(a * a + b * b);\r\nSystem.out.println(\"Hypotenuse is \" + c);\r\n}\r\n}<\/pre>\n<ul>\n<li>Here, three local variables\u2014a, b, and c\u2014are declared. The first two, a and b, are initialized by constants.<\/li>\n<li>c is initialized dynamically to the length of the hypotenuse.<\/li>\n<li>The program uses another of Java\u2019s built-in methods, sqrt( ), which is a member of the Math class, to compute the square root of its argument.<\/li>\n<li>The key point here is that the initialization expression may use any element valid at the time of the initialization, including calls to methods, other variables, or literals.<\/li>\n<\/ul>\n<h3>The Scope and Lifetime of Variables<\/h3>\n<p>So far, all of the variables used have been declared at the start of the main( ) method. However, Java allows variables to be declared within any block. A block defines a scope. Thus, each time you start a new block, you are creating a new scope. A scope determines what objects are visible to other parts of your program. It also determines the lifetime of those objects.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><b>There are three kinds of variables in Java based on scope &amp; lifetime<\/b><\/p>\n<p><b>Local Variable\u00a0:<\/b> Local variables are declared in methods, constructors, or blocks.<\/p>\n<p><b>Global Variable\/Instance Variable\u00a0: <\/b>Instance variables are declared in a class, but outside a method, constructor or any block.<\/p>\n<p>Instance variable are also variable of object commonly known as field or property. They are referred as object variable. Each object has its own copy of each variable and thus, it doesn&#8217;t effect the instance variable if one object changes the value of the variable.<\/p>\n<pre class=\"brush:java\">class Student\r\n{\r\n String name;\r\n int age;\r\n}<\/pre>\n<p>Here\u00a0<b>name<\/b> and\u00a0<b>age<\/b> are instance variable of Student class.<\/p>\n<p><b>Class\/Static Variables : <\/b>Class variables also known as static variables are declared with the static keyword in a class. Static variables are also used in declaring constant along with final keyword. we will see about static variable in detail in upcoming chapters<\/p>\n<pre class=\"brush:java\">class Student\r\n{\r\n String name;\r\n int age;\r\n static int collegeCode =1101;\r\n}<\/pre>\n<p>Here\u00a0<b>collegeCode<\/b>\u00a0is a static variable. Each object of Student class will share\u00a0<b>collegeCode<\/b>\u00a0property.<\/p>\n<p>Scope of the varialbe with example Program<\/p>\n<pre class=\"brush:java\">\/\/ Demonstrate block scope.\r\nclass Scope {\r\npublic static void main(String args[]) {\r\nint x; \/\/ known to all code within main\r\nx = 10;\r\nif(x == 10) { \/\/ start new scope\r\nint y = 20; \/\/ known only to this block\r\n\/\/ x and y both known here.\r\nSystem.out.println(\"x and y: \" + x + \" \" + y);\r\nx = y * 2;\r\n}\r\n\/\/ y = 100; \/\/ Error! y not known here\r\n\/\/ x is still known here.\r\nSystem.out.println(\"x is \" + x);\r\n}\r\n}<\/pre>\n<p>Within a block, variables can be declared at any point, but are valid only after they are declared. If you define a variable at the start of a method, it is available to all of the code within that method.<\/p>\n<ul>\n<li>Variables are created when their scope is entered, and destroyed when their scope is left.<\/li>\n<li>Variable will not hold its value once it has gone out of scope.<\/li>\n<li>Variables declared within a method will not hold their values between calls to that method. Also, a variable declared within a block will lose its value when the block is left. Thus, the lifetime of a variable is confined to its scope.<\/li>\n<li>If a variable declaration includes an initializer, then that variable will be reinitialized each<\/li>\n<li>time the block in which it is declared is entered.<\/li>\n<\/ul>\n<pre class=\"brush:java\">\/\/ Demonstrate lifetime of a variable.\r\nclass LifeTime {\r\npublic static void main(String args[]) {\r\nint x;\r\nfor(x = 0; x &lt; 3; x++) {\r\nint y = -1; \/\/ y is initialized each time block is entered\r\nSystem.out.println(\"y is: \" + y); \/\/ this always prints -1\r\ny = 100;\r\nSystem.out.println(\"y is now: \" + y);\r\n}\r\n}\r\n}<\/pre>\n<p><b>Output<\/b><\/p>\n<pre class=\"brush:bash\">y is: -1\r\ny is now: 100\r\ny is: -1\r\ny is now: 100\r\ny is: -1\r\ny is now: 100<\/pre>\n<h3>Duplicate Variable\u00a0 Error<\/h3>\n<p>Although blocks can be nested, you cannot declare a variable to have the same name as one in an outer scope. For example, the following program is illegal:<\/p>\n<pre class=\"brush:java\">\/\/ This program will not compile\r\nclass ScopeErr {\r\npublic static void main(String args[]) {\r\nint bar = 1;\r\n{ \/\/ creates a new scope\r\nint bar = 2; \/\/ Compile-time error \u2013 bar already defined!\r\n}\r\n}\r\n}<\/pre>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Annamalai Thangaraj, partner at our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/www.javatutorialcorner.com\/2017\/10\/java-variables.html\" target=\"_blank\" rel=\"noopener\">Java Variables<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Variables The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional initializer. In addition, all variables have a scope, which defines their visibility, and a lifetime. These elements are examined next. Declaring a Variable In Java, all variables &hellip;<\/p>\n","protected":false},"author":881,"featured_media":148,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-69436","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Variables - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Variables The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Variables - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Variables The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/javatutorialscorner\" \/>\n<meta property=\"article:published_time\" content=\"2017-10-06T07:00:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Annamalai Thangaraj\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/tannamalaibtech\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Annamalai Thangaraj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html\"},\"author\":{\"name\":\"Annamalai Thangaraj\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9bfa88db39395aab85f1f32533032e47\"},\"headline\":\"Java Variables\",\"datePublished\":\"2017-10-06T07:00:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html\"},\"wordCount\":791,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"articleSection\":[\"Core Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html\",\"name\":\"Java Variables - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"datePublished\":\"2017-10-06T07:00:03+00:00\",\"description\":\"Variables The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/java-variables.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/core-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java Variables\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9bfa88db39395aab85f1f32533032e47\",\"name\":\"Annamalai Thangaraj\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/79e59360bb96a152da3d4c669fb61d3aa9765419386bb093fa4ab9006c8e360f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/79e59360bb96a152da3d4c669fb61d3aa9765419386bb093fa4ab9006c8e360f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/79e59360bb96a152da3d4c669fb61d3aa9765419386bb093fa4ab9006c8e360f?s=96&d=mm&r=g\",\"caption\":\"Annamalai Thangaraj\"},\"description\":\"Annamalai is a Software Engineer with 2+ years experience in Java, Spring, Struts, Hibernate, IDM\\\/IAM, and Enterprise Web Application Development.\",\"sameAs\":[\"http:\\\/\\\/www.javatutorialcorner.com\\\/\",\"https:\\\/\\\/www.facebook.com\\\/javatutorialscorner\",\"http:\\\/\\\/in.linkedin.com\\\/in\\\/annamalaithangaraj\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/tannamalaibtech\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/annamalai-thangaraj\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Variables - Java Code Geeks","description":"Variables The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html","og_locale":"en_US","og_type":"article","og_title":"Java Variables - Java Code Geeks","og_description":"Variables The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional","og_url":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/javatutorialscorner","article_published_time":"2017-10-06T07:00:03+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","type":"image\/jpeg"}],"author":"Annamalai Thangaraj","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/tannamalaibtech","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Annamalai Thangaraj","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html"},"author":{"name":"Annamalai Thangaraj","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9bfa88db39395aab85f1f32533032e47"},"headline":"Java Variables","datePublished":"2017-10-06T07:00:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html"},"wordCount":791,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","articleSection":["Core Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html","url":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html","name":"Java Variables - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","datePublished":"2017-10-06T07:00:03+00:00","description":"Variables The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/java-variables.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/core-java"},{"@type":"ListItem","position":4,"name":"Java Variables"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9bfa88db39395aab85f1f32533032e47","name":"Annamalai Thangaraj","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/79e59360bb96a152da3d4c669fb61d3aa9765419386bb093fa4ab9006c8e360f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/79e59360bb96a152da3d4c669fb61d3aa9765419386bb093fa4ab9006c8e360f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/79e59360bb96a152da3d4c669fb61d3aa9765419386bb093fa4ab9006c8e360f?s=96&d=mm&r=g","caption":"Annamalai Thangaraj"},"description":"Annamalai is a Software Engineer with 2+ years experience in Java, Spring, Struts, Hibernate, IDM\/IAM, and Enterprise Web Application Development.","sameAs":["http:\/\/www.javatutorialcorner.com\/","https:\/\/www.facebook.com\/javatutorialscorner","http:\/\/in.linkedin.com\/in\/annamalaithangaraj","https:\/\/x.com\/https:\/\/twitter.com\/tannamalaibtech"],"url":"https:\/\/www.javacodegeeks.com\/author\/annamalai-thangaraj"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/69436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/881"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=69436"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/69436\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/148"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=69436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=69436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=69436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}