User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:util:scanner:nextshort
click
to support this page (eg 0,42 € or so) Thanks.

nextShort()

public short nextShort()

return short scanned from the input

example nextShort() 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); 
 
        short currency;
 
        System.out.print("Please enter a number: ");
        currency = scan.nextShort(); // read keyboard buffer
 
        System.out.println("Number is " + currency);
 
        scan.close(); // close the object 
    }
}

output of nextShort()

  Please enter a number: 42
  Number is 42
advertising
java/util/scanner/nextshort.txt · Last modified: 2013/04/10 10:14 by 94.223.12.247

Impressum