java take input from the keyboard/console

‮//:sptth‬www.lautturi.com
java take input from the keyboard/console
/**
 * @author lautturi.com 
 * Java example:  get input from keyboard in java
 */

import java.util.*;

public class Lautturi {
	public static void main(String args[]) {
		// creates an object of Scanner , get input from standard input
		Scanner input = new Scanner(System.in);
		System.out.print("Enter your name: ");
		// takes input from the keyboard
		String name = input.nextLine();

		// prints the name
		System.out.println("My name is " + name);

		// closes the scanner
		input.close();
	}
}
Created Time:2017-09-28 14:14:27  Author:lautturi