Getting User Input in Java. Programul returneaza nr. introdus de la tastatura.

import java.util.Scanner;
public class Application {

	public static void main(String[] args) {
		try (// Create scanner object
		Scanner input = new Scanner(System.in)) {
			// Output the prompt
			System.out.println("Introduceti un numar: ");
			 
			// Wait for the user to enter something.
			double value = input.nextDouble();
			 
			// Tell them what they entered.
			System.out.println("Ati introdus: " + value);
		}

	}

}
Output: Programul returneaza nr introdus de la tastatura in format zecimal.