User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:util:scanner:nextlong

nextLong()

public long nextLong()

return long scanned from the input

example nextLong() in java

package scanner;
 
import java.util.Scanner;
 
public class Scanner {
 
    public static void main(String[] args) {
 
        /* Create Scanner Object for the input from the keyboard */
        Scanner scan = new Scanner(System.in); 
 
        long currency;
 
        System.out.print("Please enter a number: ");
        currency = scan.nextLong(); // read keyboard buffer
 
        System.out.println("Number is " + currency);
 
        scan.close(); // close the object 
    }
}

output of nextLong()

  Please enter a number: 42
  Number is 42

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
java/util/scanner/nextlong.txt · Last modified: 2024/02/16 01:12 (external edit)

Impressum Datenschutz