{"id":1777,"date":"2016-09-26T04:40:31","date_gmt":"2016-09-26T04:40:31","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1777"},"modified":"2016-09-26T06:54:52","modified_gmt":"2016-09-26T06:54:52","slug":"what-is-default-type-of-numbers-in-java","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/what-is-default-type-of-numbers-in-java\/","title":{"rendered":"What is default type of Numbers in Java"},"content":{"rendered":"<p>If I write something like this<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n System.out.println(19);\r\n<\/pre>\n<p><strong>Which type has the &#8217;19&#8217;? Is it int or byte? Or doesn&#8217;t it have a type yet?<\/strong><br \/>\nThis 19 is known as an <strong>integer literal<\/strong>. There are all sorts of literals, floating point, String, character, etc.<\/p>\n<p><strong>What is integer literal<\/strong><br \/>\nInteger data types consist of the following primitive data types: int,long, byte, and short.byte, int, long, and short can be expressed in decimal(base<br \/>\n10), hexadecimal(base 16) or octal(base 8) number systems as well.<br \/>\nPrefix 0 is used to indicate octal and prefix 0x indicates hexadecimal when using these number systems for literals.<\/p>\n<p><strong>Examples:<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nint decimal = 100;\r\nint octal = 0144;\r\nint hexa =  0x64;\r\n<\/pre>\n<p>Literal means any number,Text or Other information that represents a value.<\/p>\n<p>Different Values that can be assigned to Integer Variable (Integer data type Literal) are<\/p>\n<ol>\n<li>Decimal Literals<\/li>\n<li>Octal Literals<\/li>\n<li>Hexadecimal Literals<\/li>\n<li>Binary Literals<\/li>\n<li>Long Literals<\/li>\n<li>Values with Underscore in Between<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>If I write something like this System.out.println(19); Which type has the &#8217;19&#8217;? Is it int or byte? Or doesn&#8217;t it have a type yet? This 19 is known as an integer literal. There are all sorts of literals, floating point, String, character, etc. What is integer literal Integer data types consist of the following primitive&hellip; <a href=\"https:\/\/codethataint.com\/blog\/what-is-default-type-of-numbers-in-java\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[172],"tags":[],"class_list":["post-1777","post","type-post","status-publish","format-standard","hentry","category-variables"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1777","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1777"}],"version-history":[{"count":3,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1777\/revisions"}],"predecessor-version":[{"id":1780,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1777\/revisions\/1780"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}