{"id":10960,"date":"2018-10-07T21:43:17","date_gmt":"2018-10-07T14:43:17","guid":{"rendered":"https:\/\/huongdanjava.com\/?p=10960"},"modified":"2018-10-07T21:43:17","modified_gmt":"2018-10-07T14:43:17","slug":"primitive-variable-in-java-part-1","status":"publish","type":"post","link":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html","title":{"rendered":"Primitive variable in Java &#8211; Part 1"},"content":{"rendered":"<p>Primitive data types are the simplest types in every programming language in general and Java in particular. In Java, we have eight primitive data types:<\/p>\n<ul>\n<li><strong>char<\/strong><\/li>\n<li><strong>byte<\/strong><\/li>\n<li><strong>short<\/strong><\/li>\n<li><strong>int<\/strong><\/li>\n<li><strong>long<\/strong><\/li>\n<li><strong>float<\/strong><\/li>\n<li><strong>double<\/strong><\/li>\n<li><strong>boolean<\/strong><\/li>\n<\/ul>\n<p>Variables defined with primitive data types are called primitive variables. In this tutorial, we will look at the primitive data types in Java, how to create and assign initial values to a primitive variable.<br \/>\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-7304065639390615\" data-ad-slot=\"6822390817\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h3>char<\/h3>\n<p>The syntax for defining a variable of type char is as follows:<\/p>\n<pre class=\"lang:java decode:true\">char &lt;variable_name&gt; = 'value of variable';<\/pre>\n<p>For example:<\/p>\n<pre class=\"lang:java decode:true \">char a = 'A';<\/pre>\n<p>As you can see, the value of the char variable will be placed in a single bracket, if you put it in quotation marks like declaring a variable for a String, then the compile error will occur.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10964 size-full\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2018\/10\/primitive-variable-in-java-part-1-1.png\" alt=\"Primitive variable in Java - Part 1\" width=\"463\" height=\"188\" \/><\/p>\n<p>A char variable represents 16 bits of Unicode characters, which can represent all characters in all languages, from simple English characters to complex Japanese characters, Korean and also Vietnamese. Its value is expressed in Unicode form between &#8220;\\u0000&#8221; (0) and &#8220;\\uffff&#8221; (65535). And in Java, the char variable is stored with a positive number between 0 and 65535.<\/p>\n<p>In the example above, we declare variable a with the value of A, corresponding to the letter A, which is 65 in the ASCII (American Standard Code for Information Interchange) and thus another way to declare the variable. char in Java that we can use that is:<\/p>\n<pre class=\"lang:java decode:true \">char a = 65;<\/pre>\n<p>When running the above code:<\/p>\n<pre class=\"lang:java decode:true\">package com.huongdanjava;\r\n\r\npublic class Example {\r\n\r\n    public static void main(String[] args) {\r\n        char a = 65;\r\n        System.out.println(a);\r\n    }\r\n}\r\n<\/pre>\n<p>The result will be A.<\/p>\n<p>You can refer to the ASCII code table below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10965 size-full\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2018\/10\/primitive-variable-in-java-part-1-2.gif\" alt=\"Primitive variable in Java - Part 1\" width=\"700\" height=\"478\" \/><\/p>\n<p>As I said above the value of the char variable is a positive number, so if you assign it a negative value, it will have a compile error:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10966 size-full\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2018\/10\/primitive-variable-in-java-part-1-3.png\" alt=\"Primitive variable in Java - Part 1\" width=\"470\" height=\"225\" \/><\/p>\n<p>But if you declare char variables with negative numbers by pressing the type, it is still ok, no compile error:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10967 size-full\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2018\/10\/primitive-variable-in-java-part-1-4.png\" alt=\"Primitive variable in Java - Part 1\" width=\"396\" height=\"162\" \/><\/p>\n<p>But when you run, the result will always be:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10968 size-full\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2018\/10\/primitive-variable-in-java-part-1-5.png\" alt=\"Primitive variable in Java - Part 1\" width=\"593\" height=\"75\" \/><br \/>\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-7304065639390615\" data-ad-slot=\"6822390817\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h3>byte<\/h3>\n<p>A byte is an 8-bit data type with values ranging from -128 to 127.<\/p>\n<p>The byte variable declaration example is as follows:<\/p>\n<pre class=\"lang:java decode:true \">byte a = 83;<\/pre>\n<h3>short<\/h3>\n<p>short is larger than byte, 16bits, with values greater than bytes from -32.768 to 32.767.<\/p>\n<p>The short variable declaration is as follows:<\/p>\n<pre class=\"lang:java decode:true \">short a = 12345;<\/pre>\n<h3>int<\/h3>\n<p>int is 32 bits in size, ranging from -2,147,483,648 to 2,147,483,647.<\/p>\n<p>Declare the int variable as follows:<\/p>\n<pre class=\"lang:java decode:true \">int a = 100;<\/pre>\n<h3>long<\/h3>\n<p>Long is a 64-bit data type, its value ranges from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.807.<\/p>\n<p>The variable declaration is as follows:<\/p>\n<pre class=\"lang:java decode:true \">long a = 234;<\/pre>\n<p><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<ins class=\"adsbygoogle\"\n     style=\"display:block; text-align:center;\"\n     data-ad-layout=\"in-article\"\n     data-ad-format=\"fluid\"\n     data-ad-client=\"ca-pub-7304065639390615\"\n     data-ad-slot=\"6822390817\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h3>Some notes for byte, short, int, and long variables<\/h3>\n<p>&#8211; When declaring a variable, if you do not assign a value to it, then the default value is 0.<\/p>\n<p>&#8211; The default data type of integers is int. Meaning when you declare the following:<\/p>\n<pre class=\"lang:java decode:true\">long a = 1000;<\/pre>\n<p>the number 1000 is int. But the mechanism of automatic conversion from int to long type of Java allows us to declare such. To specify the number 1000 is the long type, you can add the letter L or l after this number and declare as follows:<\/p>\n<pre class=\"lang:java decode:true\">long a = 1000L;\r\n<\/pre>\n<p>In addition, Java allows automatic conversion of variables between primitive types as follows (with both float and double):<\/p>\n<ul>\n<li>byte to short, int, long, float, or double.<\/li>\n<li>short to int, long, float, or double.<\/li>\n<li>char to int, long, float, or double.<\/li>\n<li>int to long, float, or double.<\/li>\n<li>long to float or double.<\/li>\n<li>float to double.<\/li>\n<\/ul>\n<p>&#8211; Java also allows us to represent these variables in binary, decimal, 8th and 16th systems.<\/p>\n<ul>\n<li>Binary variables are declared starting with 0b or 0B.<\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre class=\"lang:java decode:true\">int b\u00a0= 0b100001011;<\/pre>\n<ul>\n<li>Decimal is the number we use every day is represented as normal.<\/li>\n<\/ul>\n<p>For example;<\/p>\n<pre class=\"lang:java decode:true\">int b = 129;<\/pre>\n<ul>\n<li>The 8th system variable is declared starting with 0.<\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre class=\"lang:java decode:true \">int b = 0235;<\/pre>\n<ul>\n<li>The 16th system variable is declared starting with 0x or 0X.<\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre class=\"lang:java decode:true\">int b = 0xA;<\/pre>\n<p>&#8211; In Java 7, when declaring variables with large values, we can use underscores between numbers in your favor so that numbers can be more readable.<\/p>\n<p>For example:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10969 size-full\" src=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2018\/10\/primitive-variable-in-java-part-1-6.png\" alt=\"Primitive variable in Java - Part 1\" width=\"246\" height=\"114\" \/><\/p>\n<p>You can use underscores to declare variables in Java 7 with the following guidelines:<\/p>\n<ul>\n<li>You can not declare the underscore at the beginning or at the end of a number.<\/li>\n<li>You can not put the underscore immediately after 0b, 0B, 0x, 0X in the binary number and number in the 16th system.<\/li>\n<li>You can put the underscore after the zero in the declaration number in the 8th system.<\/li>\n<li>You can not put underscores before the letter L or other similar words (the letter L marks the value of the variable in the long type).<\/li>\n<\/ul>\n<p>This tutorial, I introduced only the first five data types, the next part I will introduce you about float, double and boolean.<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;10960&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;Primitive variable in Java - Part 1&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            <span class=\"kksr-muted\"><\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Primitive data types are the simplest types in every programming language in general and Java in particular. In Java, we have eight primitive data types: char byte short int long float double boolean Variables defined with primitive data types are called primitive variables. In this&hellip; <a href=\"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":411,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[269],"tags":[],"class_list":["post-10960","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-basic","clearfix"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Primitive variable in Java - Part 1 - Huong Dan Java<\/title>\n<meta name=\"description\" content=\"In this tutorial, I mention about 5 primitive variables in Java: char, byte, short, int v\u00e0 long.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Primitive variable in Java - Part 1 - Huong Dan Java\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, I mention about 5 primitive variables in Java: char, byte, short, int v\u00e0 long.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html\" \/>\n<meta property=\"og:site_name\" content=\"Huong Dan Java\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/nhkhanh2406\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/nhkhanh2406\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-07T14:43:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/huongdanjava.com\/wp-content\/uploads\/2016\/05\/java.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"620\" \/>\n\t<meta property=\"og:image:height\" content=\"349\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Khanh Nguyen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/KhanhNguyenJ\" \/>\n<meta name=\"twitter:site\" content=\"@KhanhNguyenJ\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khanh Nguyen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html\"},\"author\":{\"name\":\"Khanh Nguyen\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\"},\"headline\":\"Primitive variable in Java &#8211; Part 1\",\"datePublished\":\"2018-10-07T14:43:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html\"},\"wordCount\":727,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\"},\"image\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2016\\\/05\\\/java.jpg\",\"articleSection\":[\"Java Basic\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html\",\"name\":\"Primitive variable in Java - Part 1 - Huong Dan Java\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2016\\\/05\\\/java.jpg\",\"datePublished\":\"2018-10-07T14:43:17+00:00\",\"description\":\"In this tutorial, I mention about 5 primitive variables in Java: char, byte, short, int v\u00e0 long.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#primaryimage\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2016\\\/05\\\/java.jpg\",\"contentUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2016\\\/05\\\/java.jpg\",\"width\":620,\"height\":349},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/primitive-variable-in-java-part-1.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/huongdanjava.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Primitive variable in Java &#8211; Part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#website\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/\",\"name\":\"Huong Dan Java\",\"description\":\"Java development tutorials\",\"publisher\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/huongdanjava.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/#\\\/schema\\\/person\\\/dc859d7f8cbea3b593e6738de9cbb82d\",\"name\":\"Khanh Nguyen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\",\"url\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\",\"contentUrl\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\",\"width\":1267,\"height\":1517,\"caption\":\"Khanh Nguyen\"},\"logo\":{\"@id\":\"https:\\\/\\\/huongdanjava.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg\"},\"description\":\"I love Java and everything related to Java.\",\"sameAs\":[\"https:\\\/\\\/huongdanjava.com\",\"https:\\\/\\\/www.facebook.com\\\/nhkhanh2406\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/KhanhNguyenJ\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Primitive variable in Java - Part 1 - Huong Dan Java","description":"In this tutorial, I mention about 5 primitive variables in Java: char, byte, short, int v\u00e0 long.","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:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html","og_locale":"en_US","og_type":"article","og_title":"Primitive variable in Java - Part 1 - Huong Dan Java","og_description":"In this tutorial, I mention about 5 primitive variables in Java: char, byte, short, int v\u00e0 long.","og_url":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html","og_site_name":"Huong Dan Java","article_publisher":"https:\/\/www.facebook.com\/nhkhanh2406","article_author":"https:\/\/www.facebook.com\/nhkhanh2406","article_published_time":"2018-10-07T14:43:17+00:00","og_image":[{"width":620,"height":349,"url":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2016\/05\/java.jpg","type":"image\/jpeg"}],"author":"Khanh Nguyen","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/KhanhNguyenJ","twitter_site":"@KhanhNguyenJ","twitter_misc":{"Written by":"Khanh Nguyen","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#article","isPartOf":{"@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html"},"author":{"name":"Khanh Nguyen","@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d"},"headline":"Primitive variable in Java &#8211; Part 1","datePublished":"2018-10-07T14:43:17+00:00","mainEntityOfPage":{"@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html"},"wordCount":727,"commentCount":0,"publisher":{"@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d"},"image":{"@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#primaryimage"},"thumbnailUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2016\/05\/java.jpg","articleSection":["Java Basic"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html","url":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html","name":"Primitive variable in Java - Part 1 - Huong Dan Java","isPartOf":{"@id":"https:\/\/huongdanjava.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#primaryimage"},"image":{"@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#primaryimage"},"thumbnailUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2016\/05\/java.jpg","datePublished":"2018-10-07T14:43:17+00:00","description":"In this tutorial, I mention about 5 primitive variables in Java: char, byte, short, int v\u00e0 long.","breadcrumb":{"@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#primaryimage","url":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2016\/05\/java.jpg","contentUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2016\/05\/java.jpg","width":620,"height":349},{"@type":"BreadcrumbList","@id":"https:\/\/huongdanjava.com\/primitive-variable-in-java-part-1.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/huongdanjava.com\/"},{"@type":"ListItem","position":2,"name":"Primitive variable in Java &#8211; Part 1"}]},{"@type":"WebSite","@id":"https:\/\/huongdanjava.com\/#website","url":"https:\/\/huongdanjava.com\/","name":"Huong Dan Java","description":"Java development tutorials","publisher":{"@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/huongdanjava.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/huongdanjava.com\/#\/schema\/person\/dc859d7f8cbea3b593e6738de9cbb82d","name":"Khanh Nguyen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg","url":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg","contentUrl":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg","width":1267,"height":1517,"caption":"Khanh Nguyen"},"logo":{"@id":"https:\/\/huongdanjava.com\/wp-content\/uploads\/2021\/07\/CC6FAC58-D227-4DD8-93D1-6D6A795577E3_1_201_a.jpeg"},"description":"I love Java and everything related to Java.","sameAs":["https:\/\/huongdanjava.com","https:\/\/www.facebook.com\/nhkhanh2406","https:\/\/x.com\/https:\/\/twitter.com\/KhanhNguyenJ"]}]}},"_links":{"self":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts\/10960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/comments?post=10960"}],"version-history":[{"count":8,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts\/10960\/revisions"}],"predecessor-version":[{"id":10975,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/posts\/10960\/revisions\/10975"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/media\/411"}],"wp:attachment":[{"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/media?parent=10960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/categories?post=10960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/huongdanjava.com\/wp-json\/wp\/v2\/tags?post=10960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}