Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.Console;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

        Console cnsl = System.console();

        if (cnsl != null) {
            System.out.print("Enter name : ");
            Scanner scan = new Scanner(cnsl.reader());
            while (scan.hasNext()) {
                String str = scan.next();
                System.out.println(str);
            }
        }
    }
}