{"id":19288,"date":"2020-07-10T15:43:43","date_gmt":"2020-07-10T22:43:43","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19288"},"modified":"2023-12-01T03:53:41","modified_gmt":"2023-12-01T11:53:41","slug":"java-boolean","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/java-boolean\/","title":{"rendered":"Java Boolean: A Beginner\u2019s Guide"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Use Booleans in Java <\/h2>\n\n\n\n<p>True or false. We\u2019re not talking about a question on a standardized test. True and false are the values that can be stored inside the Boolean data type.<br><\/p>\n\n\n\n<p>In programming, Booleans are used to control the flow of a program. They are also used to make comparisons between values.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to talk about the basics of how Booleans work. We\u2019ll discuss how to make comparisons with Booleans, and how to use logical operators. Let\u2019s get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a Java Boolean?<\/h2>\n\n\n\n<p>A boolean is a data type that can store one of two values: true and false.<br><\/p>\n\n\n\n<p>Booleans are a key part of logical operations in mathematics. They\u2019re useful when the answer to a problem can only be one of two values. A boolean value could represent on or off, true or false, yes or no, or any other situation where only two possible outcomes are valid.<br><\/p>\n\n\n\n<p>The Boolean data type is capitalized when we talk about it. This is because it was named after the mathematician George Boole, who played a key role in the fields of logic and algebra. However, when you are declaring a boolean, you should use lowercase.<br><\/p>\n\n\n\n<p>In Java, booleans are declared using the boolean keyword. Let\u2019s declare a boolean which tracks whether a coffee house has its premium beans in stock:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>boolean premiumBeans = true;\nSystem.out.println(premiumBeans);<\/pre><\/div>\n\n\n\n<p>Our code returns: true. We\u2019ve stored the value \u201ctrue\u201d inside the variable \u201cpremiumBeans\u201d. Notice that we have declared our boolean using the <code>boolean<\/code> keyword, which appears in lowercase.<br><\/p>\n\n\n\n<p>Boolean objects represent false or true values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Making Comparisons Using Booleans<\/h2>\n\n\n\n<p>The Boolean data type is particularly useful when making comparisons.<br><\/p>\n\n\n\n<p>This is because when you are comparing two values, a comparison can only be true or false. A string can only be equal to or not equal to another number; a number can only be less than or greater than another number.<br><\/p>\n\n\n\n<p>Let\u2019s demonstrate how this works with an example. We\u2019re going to write a program which checks whether a child at a theme park is old enough to go on a ride. We\u2019ll start by declaring two variables:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>int minimumAge = 12;\nint customerAge = 15;<\/pre><\/div>\n\n\n\n<p>The variable \u201cminimumAge\u201d tells us the minimum age you have to be to go on a ride. The variable \u201ccustomerAge\u201d is the age of the child who wants to go on the ride.<br><\/p>\n\n\n\n<p>To check whether the customer is old enough to go on the ride, we can use a comparison operator:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>boolean isOldEnough = customerAge &gt;= minimumAge;\nSystem.out.println(\"Is the customer old enough to ride? \", String.valueOf(isOldEnough));<\/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>Is the customer old enough to ride? true<\/pre><\/div>\n\n\n\n<p>We have declared a new variable called \u201cisOldEnough\u201d. This variable represents the specified boolean which is calculated using our comparison statement. We check whether the customer\u2019s age is greater than or equal to the minimum age. If it is, isOldEnough will be equal to true; otherwise, it will be false.<br><\/p>\n\n\n\n<p>15 (customerAge) is greater than 12 (minimumAge). This means that our expression evaluates to true, and so our boolean object represents the value true.<br><\/p>\n\n\n\n<p>We can use any Java comparison operator to perform a comparison:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>==: Equal to<\/li>\n\n\n\n<li>!=: Not equal to<\/li>\n\n\n\n<li>&gt;: Greater than<\/li>\n\n\n\n<li>&lt;: Less than<\/li>\n\n\n\n<li>&gt;=: Greater than or equal to<\/li>\n\n\n\n<li>&lt;=: Less than or equal to<\/li>\n<\/ul>\n\n\n\n<p>Consider the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>int minimumAge = 12;\nint customerAge = 15;\nboolean isMinimumAge = customerAge == minimumAge;\nSystem.out.println(\"Is the customer's age equal to the minimum age? \", String.valueOf(isMinimumAge));<\/pre><\/div>\n\n\n\n<p>In this code, we have compared whether or not the customer\u2019s age is equal to the minimum age. These numbers are not equal, so our Boolean expression evaluates to false:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Is the customer's age equal to the minimum age? False<\/pre><\/div>\n\n\n\n<p>When you are comparing to see whether two values are equal, you must use two equals signs (==). One equals sign is used to assign a value to a variable in Java; two equals signs denote that you want to make a comparison.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Boolean Logical Operators<\/h2>\n\n\n\n<p>Booleans can be used with Java\u2019s logical operators to determine whether multiple expressions are met. These operators will return a boolean value: true or false.<br><\/p>\n\n\n\n<p>There are three logical operators:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&amp;&amp; (and): Returns \u201ctrue\u201d if both values are true<\/li>\n\n\n\n<li>! (not): Returns \u201ctrue\u201d if a value is false<\/li>\n\n\n\n<li>|| (or): Returns \u201ctrue\u201d if at least one value is true<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s use an example to show these operators in action. For example, suppose that we\u2019re building a program that evaluates whether a customer should receive a discount on a purchase.<br><\/p>\n\n\n\n<p>A discount should be given if a user\u2019s purchase is over $40 and the user is a loyalty card member. We could check for these conditions using this statement:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>int purchasePrice = 50;\nboolean isLoyaltyCustomer = true;\nSystem.out.println((purchasePrice &gt; 40) &amp;&amp; (isLoyaltyCustomer == true));<\/pre><\/div>\n\n\n\n<p>Our code returns: true. Our code evaluates three expressions:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Is purchasePrice greater than 40?<\/li>\n\n\n\n<li>Is isLoyaltyCustomer equal to true?<\/li>\n\n\n\n<li>Is purchasePrice greater than 40 and is isLoyaltyCustomer equal to true?<\/li>\n<\/ul>\n\n\n\n<p>If all of these conditions are met \u2013 which they are in this case \u2013 true is returned. Otherwise, false is returned.<br><\/p>\n\n\n\n<p>Let\u2019s say that we want to give our discount to people who make a purchase greater than $40 or who are loyalty card members. We could do this by changing our logical operator to \u201c||\u201d (the \u201cor\u201d operator) instead of \u201c&amp;&amp;\u201d (the \u201cand\u201d operator):<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>int purchasePrice = 30;\nboolean isLoyaltyCustomer = true;\nSystem.out.println((purchasePrice &gt; 40) || (isLoyaltyCustomer == true));<\/pre><\/div>\n\n\n\n<p>Our code returns: true. Our program checks:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Is purchasePrice greater than 40?<\/li>\n\n\n\n<li>Is isLoyaltyCustomer equal to true?<\/li>\n\n\n\n<li>Is purchasePrice greater than 40 or is isLoyaltyCustomer equal to true?<\/li>\n<\/ul>\n\n\n\n<p>Only one of the two conditions we have specified needs to be met for true to be returned. In this case, isLoyaltyCustomer is equal to true, so our code returns true.<br><\/p>\n\n\n\n<p>We can use the not operator to check whether a value is false. Suppose we only want to give the discount to people who are not loyal customers because they already receive a spare discount. We could enforce this using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>boolean isLoyaltyCustomer = true;\nSystem.out.println(!isLoyaltyCustomer);<\/pre><\/div>\n\n\n\n<p>In this code, we check if \u201cisLoyaltyCustomer\u201d is not true. \u201cisLoyaltyCustomer\u201d is equal to true, so our code returns false.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Booleans with Conditionals<\/h2>\n\n\n\n<p>Booleans are often used with conditional statements such as an <code>if<\/code> statement.<br><\/p>\n\n\n\n<p>A conditional will evaluate a statement down to a true or false value. If a condition is true, the code within a conditional block will run; otherwise, that code will not run.<br><\/p>\n\n\n\n<p>Let\u2019s say that we want to print a message to the console if a customer is eligible for a discount. A customer is eligible for a discount only if they are a loyalty customer:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>boolean isLoyaltyCustomer = true;\nif (isLoyaltyCustomer == true) {\n\tSystem.out.println(\"This customer is eligible for a discount.\");\n} else {\n\tSystem.out.println(\"This customer is not eligible for a discount.\");\n}<\/pre><\/div>\n\n\n\n<p>Our code returns a string object:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>This customer is eligible for a discount.<\/pre><\/div>\n\n\n\n<p>Our code checks to see whether the value of \u201cisLoyaltyCustomer\u201d is equal to true. It is, and so the code within our <code>if<\/code> statement is run.<br><\/p>\n\n\n\n<p>If our customer was not a loyalty card holder, this statement would evaluate to false. In this case, the contents of our <code>else<\/code> statement would be run.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Booleans allow you to store true or false values in your code. When used with comparison operators, you can use a boolean to evaluate a statement.<br><\/p>\n\n\n\n<p>You can use logical operators with a boolean to determine if multiple conditions are met, if one of multiple conditions are met, or if a condition is not met. Booleans are often used with conditional statements such as an <code>if<\/code> statement to evaluate an expression.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to work with booleans in Java like a professional!<\/p>\n","protected":false},"excerpt":{"rendered":"How to Use Booleans in Java True or false. We\u2019re not talking about a question on a standardized test. True and false are the values that can be stored inside the Boolean data type. In programming, Booleans are used to control the flow of a program. They are also used to make comparisons between values.&hellip;","protected":false},"author":240,"featured_media":19289,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17289],"tags":[],"class_list":{"0":"post-19288","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.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Java Boolean: A Beginner\u2019s Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"Booleans are used to store true or false values. On Career Karma, learn how to work with Java booleans in your programs.\" \/>\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-boolean\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Boolean: A Beginner\u2019s Guide\" \/>\n<meta property=\"og:description\" content=\"Booleans are used to store true or false values. On Career Karma, learn how to work with Java booleans in your programs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/java-boolean\/\" \/>\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-07-10T22:43:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:53:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Java Boolean: A Beginner\u2019s Guide\",\"datePublished\":\"2020-07-10T22:43:43+00:00\",\"dateModified\":\"2023-12-01T11:53:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/\"},\"wordCount\":1168,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg\",\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/java-boolean\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/\",\"name\":\"Java Boolean: A Beginner\u2019s Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg\",\"datePublished\":\"2020-07-10T22:43:43+00:00\",\"dateModified\":\"2023-12-01T11:53:41+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Booleans are used to store true or false values. On Career Karma, learn how to work with Java booleans in your programs.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/java-boolean\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-boolean\/#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 Boolean: A Beginner\u2019s Guide\"}]},{\"@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\/#\/schema\/person\/image\/\",\"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 Boolean: A Beginner\u2019s Guide | Career Karma","description":"Booleans are used to store true or false values. On Career Karma, learn how to work with Java booleans in your programs.","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-boolean\/","og_locale":"en_US","og_type":"article","og_title":"Java Boolean: A Beginner\u2019s Guide","og_description":"Booleans are used to store true or false values. On Career Karma, learn how to work with Java booleans in your programs.","og_url":"https:\/\/careerkarma.com\/blog\/java-boolean\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-10T22:43:43+00:00","article_modified_time":"2023-12-01T11:53:41+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Java Boolean: A Beginner\u2019s Guide","datePublished":"2020-07-10T22:43:43+00:00","dateModified":"2023-12-01T11:53:41+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/"},"wordCount":1168,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg","articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/java-boolean\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/","url":"https:\/\/careerkarma.com\/blog\/java-boolean\/","name":"Java Boolean: A Beginner\u2019s Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg","datePublished":"2020-07-10T22:43:43+00:00","dateModified":"2023-12-01T11:53:41+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Booleans are used to store true or false values. On Career Karma, learn how to work with Java booleans in your programs.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/java-boolean\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/markus-spiske-AaEQmoufHLk-unsplash.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/java-boolean\/#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 Boolean: A Beginner\u2019s Guide"}]},{"@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\/#\/schema\/person\/image\/","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\/19288","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=19288"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19288\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19289"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}