{"id":1506,"date":"2022-08-01T21:16:01","date_gmt":"2022-08-01T21:16:01","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=1506"},"modified":"2022-08-18T15:08:32","modified_gmt":"2022-08-18T15:08:32","slug":"scanner-nextlong-java","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/scanner-nextlong-java\/","title":{"rendered":"Scanner nextLong() Method in Java"},"content":{"rendered":"\n<p class=\"has-text-align-center\"><strong>Scanner nextLong Method in Java<\/strong><\/p>\n\n\n\n<p>Well, sometimes, we are required to take some long-type data as user input. If we are in such a situation, we can make use of this method. We can simply say that the nextLong method is going to help us get the long-type data as user input.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting the long type data as user input (nextLong method)<\/h2>\n\n\n\n<p>Let&#8217;s have a look at a program, where we try to demonstrate the nextLong method.<\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background\"><br>package com.company;<br>import java.util.Scanner;<br>public class Main {<br>public static void main(String[] args) {<br>Scanner scanner = new Scanner(System.in);<br>long storeslong = scanner.nextLong();<br>System.out.println(storeslong);<br>}<br>}<\/p>\n\n\n\n<p>So, if you try implementing the above program, you can give input of type long. The range of long is from -263 to 263 \u2013 1. we are storing the long data into the long type variable.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scanner nextLong Method in Java Well, sometimes, we are required to take some long-type data as user input. If we are in such a situation, we can make use of this method. We can simply say that the nextLong method is going to help us get the long-type data as user input. Getting the long [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[12,11],"class_list":{"0":"post-1506","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-java-tutorial","7":"tag-java","8":"tag-java-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=1506"}],"version-history":[{"count":5,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1506\/revisions"}],"predecessor-version":[{"id":2684,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1506\/revisions\/2684"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=1506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=1506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=1506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}