User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:util:scanner:nextdouble

nextDouble()

public double nextDouble()

double scanned from the input

example nextDouble 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); 
 
        double currency, amount, exchangeRate;
        String currencyName, newCurrency;
 
        System.out.print("Please enter the amount (with decimal places) a of Change done to: ");
        currency = scan.nextDouble(); // read keyboard buffer
 
        System.out.println("Currency is " + currency);
 
        scan.close(); // close the object 
    }
}

output of nextDouble()

  Please enter the amount (with decimal places) a of Change done to: 42,02
  Currency is 42.02

on the occasion of the current invasion of Russia in Ukraine

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

Impressum Datenschutz