{"id":951,"date":"2019-07-15T02:25:17","date_gmt":"2019-07-15T02:25:17","guid":{"rendered":"http:\/\/kabiliravi.com\/?page_id=951"},"modified":"2019-07-29T02:22:08","modified_gmt":"2019-07-29T02:22:08","slug":"primitive-data-types","status":"publish","type":"page","link":"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-java-tutorial\/java-basic-syntax\/primitive-data-types\/","title":{"rendered":"Primitive Data Types"},"content":{"rendered":"\n<p>Primitive types are the basic data types serve as the building blocks of data manipulation in any programming language including Java. <\/p>\n\n\n\n<p>In a programming language, a variable has a type such as Integer, String, Decimal, \u2026 whether that programming language is a&nbsp;<strong><a href=\"http:\/\/wiki.c2.com\/?StaticTyping\">Static Typing<\/a><\/strong>&nbsp;such as C\/C++ and Java or&nbsp;<strong><a href=\"http:\/\/wiki.c2.com\/?DynamicTyping\">Dynamic Typing<\/a><\/strong>&nbsp;like PHP, javascript and Python.<\/p>\n\n\n\n<p>In Java like other programming languages we have built-in primitive data types. A primitive date type is a&nbsp;<em>basic data type<\/em>&nbsp;provided by a programming language as a basic building block.&nbsp;<br>Here is the list of primitive date types in Java:<\/p>\n\n\n\n<table style=\"font-size: 9pt;\">\n<tr>\n<td><b>Category<\/b><\/td>\n<td width=\"10%\"><b>Types<\/b><\/td>\n<td width=\"5%\"><b>Size (bits)<\/b><\/td>\n<td width=\"10%\"><b>Minimum Value<\/b><\/td>\n<td width=\"20%\"><b>Maximum Value<\/b><\/td>\n<td width=\"50%\"><b>Precision<\/b><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"5\"><b>Integer<\/b><\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-java-tutorial\/java-basic-syntax\/primitive-data-types\/byte-in-java\/\">byte<\/a><\/td>\n<td>8<\/td>\n<td>-128<\/td>\n<td>127<\/td>\n<td>From +127 <br> to -128<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-java-tutorial\/java-basic-syntax\/primitive-data-types\/character-in-java\/\">char<\/a><\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>2<sup>16<\/sup>-1<\/td>\n<td>All Unicode characters<\/td>\n<\/tr>\n<tr>\n<td>short<\/td>\n<td>16<\/td>\n<td>-2<sup>15<\/sup><\/td>\n<td>2<sup>15<\/sup>-1<\/td>\n<td>From +32,767 <br> to -32,768<\/td>\n<\/tr>\n<tr>\n<td>int<\/td>\n<td>32<\/td>\n<td>-2<sup>31<\/sup><\/td>\n<td>2<sup>31<\/sup><\/td>\n<td>From +2,147,483,647 to -2,147,483,648<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"4\"><b>Floating<br>Point<\/b><\/td>\n<\/tr>\n<tr>\n<td>long<\/td>\n<td>64<\/td>\n<td>-2<sup>63<\/sup><\/td>\n<td>2<sup>63<\/sup><\/td>\n<td>From +9,223,372,036,854,775,807 <br>to -9,223,372,036,854,775,808<\/td>\n<\/tr>\n<tr>\n<td>float<\/td>\n<td>32<\/td>\n<td>-2<sup>149<\/sup><\/td>\n<td>(2-2<sup>-23<\/sup>)\u00b72<sup>127<\/sup><\/td>\n<td>From 3.402,823,5 E+38 to 1.4 E-45<\/td>\n<\/tr>\n<tr>\n<td>double<\/td>\n<td>64<\/td>\n<td>-2<sup>1074<\/sup><\/td>\n<td>(2-2<sup>-52<\/sup>)\u00b72<sup>1023<\/sup><\/td>\n<td>From 1.797,693,134,862,315,7 E+308 <br>to 4.9 E-324<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\"><b> Other <\/b><\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-java-tutorial\/java-basic-syntax\/primitive-data-types\/boolean-in-java\/\">boolean<\/a><\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>false, true<\/td>\n<\/tr>\n<tr>\n<td>void<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<\/table>\n\n\n\n<p>I created couple of samples in&nbsp;<br><a href=\"https:\/\/github.com\/myjavacoretutorial\/primitive-types.git\">https:\/\/github.com\/myjavacoretutorial\/primitive-types.git<\/a> to play with each type.<\/p>\n\n\n\n<p>Here your can find a brief description and sample for each Java primitive type:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-java-tutorial\/java-basic-syntax\/primitive-data-types\/boolean-in-java\/\">boolean<\/a><\/li><li><a href=\"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-java-tutorial\/java-basic-syntax\/primitive-data-types\/byte-in-java\/\">byte<\/a><\/li><li><a href=\"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-java-tutorial\/java-basic-syntax\/primitive-data-types\/character-in-java\/\">char<\/a><\/li><li>short<\/li><li>int<\/li><li>long<\/li><li>float<\/li><li>double<\/li><li>void<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Primitive types are the basic data types serve as the building blocks of data manipulation in any programming language including Java. In a programming language, a variable has a type such as Integer, String, Decimal, \u2026 whether that programming language is a&nbsp;Static Typing&nbsp;such as C\/C++ and Java or&nbsp;Dynamic Typing&nbsp;like PHP, javascript and Python. In Java [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":910,"menu_order":2,"comment_status":"open","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-951","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/comments?post=951"}],"version-history":[{"count":67,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/951\/revisions"}],"predecessor-version":[{"id":1077,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/951\/revisions\/1077"}],"up":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/910"}],"wp:attachment":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/media?parent=951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}