{"id":13569,"date":"2020-03-20T14:08:37","date_gmt":"2020-03-20T21:08:37","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=13569"},"modified":"2023-12-01T02:34:10","modified_gmt":"2023-12-01T10:34:10","slug":"java-this","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/java-this\/","title":{"rendered":"Java This"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Use the Java this Keyword<\/h2>\n\n\n\n<p>When you\u2019re starting to code in Java, you\u2019ll likely notice the keyword <code>this<\/code> being used in methods or constructors. The <code>this<\/code> keyword refers to the current object inside methods or constructors, and has a wide range of uses in Java.<\/p>\n\n\n\n<p>In this tutorial, you\u2019ll learn about the Java this keyword and about how and why it is used. We\u2019ll also refer to a few examples throughout the article to demonstrate the this keyword in action.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java Methods and Constructors<\/h2>\n\n\n\n<p>Methods and constructors are two important parts of programming in Java.<\/p>\n\n\n\n<p>Functions, or <code>methods<\/code> as they are called in object-oriented programming, are blocks of code that perform a specific task. For instance, a method, when executed, may print out the contents of an array to the console, or facilitate user input in a program.<\/p>\n\n\n\n<p>Here is an example of a method in Java that prints <code>It\u2019s Monday!<\/code> to the console:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>public class PrintMessage {\n\tpublic static void main(String[] args) {\n\t\tSystem.out.println(\"It's Monday!\");\n\t}\n}<\/pre><\/div>\n\n\n\n<p>When we execute our code, the following output is returned to the console: <code>It\u2019s Monday!<\/code><\/p>\n\n\n\n<p>Constructors are similar to methods and are invoked when an object is instantiated, or created, in a program. Here\u2019s an example of a constructor that sets the value of an instance variable called <code>day<\/code> to <code>Monday<\/code> when an instance of Monday is instantiate and prints out <code>It\u2019s<\/code> , followed by the day of the week, to the console:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Monday {\n\tprivate Monday() {\n\t\tday = \"Monday\";\n\t}\n\tpublic static void main(String[] args) {\n\t\tMonday day_of_the_week = new Monday();\n\t\tSystem.out.println(\"It's \" + day_of_the_week.day);\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>It\u2019s Monday!<\/code><\/p>\n\n\n\n<p>If you\u2019re interested in learning more about constructors, you can read our full guide to Java constructors. Now that we\u2019ve explored the basics of Java methods and constructors, we can start to discuss the <code>this<\/code> keyword and how you can use it in your code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java this Keyword<\/h2>\n\n\n\n<p>In Java, the <code>this<\/code> keyword refers to the current object inside a method or a constructor.<\/p>\n\n\n\n<p>To illustrate this, let\u2019s use our example constructor from above that prints out the day of the week to the console. In the below example, we have printed out the value of <code>this<\/code> and the value of the <code>Monday()<\/code> object we instantiated:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Monday {\n\tprivate String day; \n\tprivate Monday() {\n\t\tday = \"Monday\";\n\t\tSystem.out.println(this);\n\t}\n\tpublic static void main(String[] args) {\n\t\tMonday day_of_the_week = new Monday();\n\t\tSystem.out.println(\"It's \" + day_of_the_week.day);\n\t\tSystem.out.println(day_of_the_week);\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns the following: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Main@d716361\nIt's Monday\nMain@d716361<\/pre><\/div>\n\n\n\n<p>The first line in our output is the value of <code>this<\/code>, which is printed to the console when the <code>Monday()<\/code> object is instantiated. The second line in our output is the result of printing out <code>It\u2019s<\/code> , followed by the value of <code>day<\/code> in the <code>day_of_the_week<\/code> object we declared. Finally, we print out the value of the <code>day_of_the_week<\/code> object.<\/p>\n\n\n\n<p>As you can see, the value of <code>this<\/code> and the <code>day_of_the_week<\/code> object are the same. This means that the <code>this<\/code> keyword refers to the current object inside a method or a constructor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java this Use Cases<\/h2>\n\n\n\n<p>There are two main situations where using the this keyword is valuable. These are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using this to disambiguate variable names<\/li>\n\n\n\n<li>Passing this as an argument<\/li>\n<\/ul>\n\n\n\n<p>A variant of the this keyword, <code>this()<\/code>, is also used when overloading constructors. However, this is a more advanced usage of this, and so we won\u2019t discuss it in this article.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using this to Disambiguate Variable Names<\/h3>\n\n\n\n<p>Two or more variables cannot have the same name inside a scope in Java. This means that if you try to declare two variables and use the same name, your program\u2019s logic will be affected.<\/p>\n\n\n\n<p>However, we can circumvent this limitation by using the <code>this<\/code> method. <code>this<\/code> allows us to assign a specific variable to an object, which allows us to store both the value of the variable in the object and the value of the initial variable.<\/p>\n\n\n\n<p>Let\u2019s walk through an example to illustrate how this works. Suppose we are building a program that keeps track of the name of a student who is being added to the honor roll in a fifth grade class. This application should print out the student\u2019s name to the console.<\/p>\n\n\n\n<p>Here\u2019s the code we will use to build this application:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class HonorRoll {\n\tString studentName;\n\tHonorRoll(String studentName) {\n\t\tthis.studentName = studentName;\n\t}\n\tpublic static void main(String[] args) {\n\t\tHonorRoll alex = new HonorRoll(\"Alex\");\n\t\tSystem.out.println(\"New honor roll inductee: \" + alex.studentName);\n\t}\n}<\/pre><\/div>\n\n\n\n<p>When we run our program, the following is returned: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>New honor roll inductee: Alex<\/pre><\/div>\n\n\n\n<p>In this example, we use <code>this<\/code> to keep track of the student\u2019s name in the <code>HonorRoll<\/code> method. We use the following line of code to assign the value of the <code>studentName<\/code> constructor parameter (which is <code>Alex<\/code> in the above example) to the variable <code>this.studentName<\/code>. If we didn\u2019t do this, the following would be returned: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>New honor roll inductee: null<\/pre><\/div>\n\n\n\n<p>This is because, in order for our <code>HonorRoll<\/code> method to store the student\u2019s name, we need to use <code>this<\/code> to remove any ambiguity from the Java compiler. So, if we remove the word <code>this<\/code> from our code, we get a null value.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Passing this as an Argument<\/h3>\n\n\n\n<p>The <code>this<\/code> keyword is often used to pass the current object in a method or constructor to another method.<\/p>\n\n\n\n<p>Suppose we are building an application that tracks how many bags of coffee beans a local coffee shop has in stock. This application should allow the coffee shop owner to add to the total of bags left in stock, which will be used when more stock becomes available. Here\u2019s the code we could use to create this application:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class AddStock {\n\tint stockToAdd;\n\tint stockTotal;\n\tAddStock(int stockToAdd, int stockTotal) {\n\t\tthis.stockToAdd = stockToAdd;\n\t\tthis.stockTotal = stockTotal;\n\t\tSystem.out.println(\"Current stock: \" + this.stockTotal);\n\t\tcalculateNewStock(this);\n\t\tSystem.out.println(\"New stock: \" + this.stockTotal);\n\t}\n\tvoid calculateNewStock(AddStock s) {\n\t\ts.stockTotal += s.stockToAdd;\n\t}\n}\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tAddStock newStockValue = new AddStock(10, 9);\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Current stock: 9\nNew stock: 19<\/pre><\/div>\n\n\n\n<p>Let\u2019s break down the code. In our code, we have defined a class called <code>AddStock<\/code>. This class contains a method which takes in two values\u2014<code>stockToAdd<\/code> and <code>stockTotal<\/code>\u2014and invokes the <code>calculateNewStock()<\/code> method to calculate how many bags of coffee the coffee shop has in stock.<\/p>\n\n\n\n<p>We then use the <code>Main()<\/code> class to initialize an instance of the AddStock class and add two values together: 10 and 9. After our program executes, our code adds the two values we specified\u2014the stock to add and the current total of stock, respectively\u2014and prints out both the current stock and the revised stock levels to the console.<\/p>\n\n\n\n<p>In this example, the <code>this<\/code> keyword is used as an argument when we call the <code>calculateNewStock()<\/code> method. This allows us to pass down the variables we are working with in the AddStock class to the <code>calculateNewStock()<\/code> method, which needs those variables to calculate the revised stock levels.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The Java this keyword refers to the current object inside a method or constructor. In Java, the this keyword has two main uses: to disambiguate variable names, and to pass this as an argument<\/p>\n\n\n\n<p>This tutorial discussed, with reference to examples, how to use the Java this keyword in those three contexts. Now you\u2019re equipped with the knowledge you need to start using the Java this keyword like an expert.<\/p>\n","protected":false},"excerpt":{"rendered":"How to Use the Java this Keyword When you\u2019re starting to code in Java, you\u2019ll likely notice the keyword this being used in methods or constructors. The this keyword refers to the current object inside methods or constructors, and has a wide range of uses in Java. In this tutorial, you\u2019ll learn about the Java&hellip;","protected":false},"author":240,"featured_media":13848,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17289],"tags":[],"class_list":{"0":"post-13569","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-java"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Java","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Java This: refers to the current object inside methods or constructors<\/title>\n<meta name=\"description\" content=\"The Java this keyword refers to the current object in a method or constructor. On Career Karma, learn about the use cases for the this keyword in your code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/java-this\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java This\" \/>\n<meta property=\"og:description\" content=\"The Java this keyword refers to the current object in a method or constructor. On Career Karma, learn about the use cases for the this keyword in your code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/java-this\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-20T21:08:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T10:34:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"681\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\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:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Java This\",\"datePublished\":\"2020-03-20T21:08:37+00:00\",\"dateModified\":\"2023-12-01T10:34:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/\"},\"wordCount\":1025,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/\",\"name\":\"Java This: refers to the current object inside methods or constructors\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"datePublished\":\"2020-03-20T21:08:37+00:00\",\"dateModified\":\"2023-12-01T10:34:10+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The Java this keyword refers to the current object in a method or constructor. On Career Karma, learn about the use cases for the this keyword in your code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"width\":1020,\"height\":681},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-this\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java This\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java This: refers to the current object inside methods or constructors","description":"The Java this keyword refers to the current object in a method or constructor. On Career Karma, learn about the use cases for the this keyword in your code.","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:\/\/careerkarma.com\/blog\/java-this\/","og_locale":"en_US","og_type":"article","og_title":"Java This","og_description":"The Java this keyword refers to the current object in a method or constructor. On Career Karma, learn about the use cases for the this keyword in your code.","og_url":"https:\/\/careerkarma.com\/blog\/java-this\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-03-20T21:08:37+00:00","article_modified_time":"2023-12-01T10:34:10+00:00","og_image":[{"width":1020,"height":681,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/java-this\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/java-this\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Java This","datePublished":"2020-03-20T21:08:37+00:00","dateModified":"2023-12-01T10:34:10+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-this\/"},"wordCount":1025,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-this\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/java-this\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/java-this\/","url":"https:\/\/careerkarma.com\/blog\/java-this\/","name":"Java This: refers to the current object inside methods or constructors","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-this\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-this\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","datePublished":"2020-03-20T21:08:37+00:00","dateModified":"2023-12-01T10:34:10+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The Java this keyword refers to the current object in a method or constructor. On Career Karma, learn about the use cases for the this keyword in your code.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/java-this\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/java-this\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/java-this\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","width":1020,"height":681},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/java-this\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/careerkarma.com\/blog\/java\/"},{"@type":"ListItem","position":3,"name":"Java This"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/13569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=13569"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/13569\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/13848"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=13569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=13569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=13569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}