get Console Input - Java Language Basics

Java examples for Language Basics:Console

Description

get Console Input

Demo Code


//package com.java2s;
import java.util.Scanner;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getConsoleInput());
    }//  ww w . j a  v a 2s  .  c o m

    public static String getConsoleInput() {
        Scanner scanner = new Scanner(System.in);
        return scanner.nextLine();
    }
}

Related Tutorials