Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.Console;

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

        String fmt = "%1$4s %2$5s %3$10s%n";

        Console cnsl = System.console();

        // if console is not null
        if (cnsl != null) {

            // read line from the user input
            String alpha = cnsl.readLine(fmt, "Enter", "Alphabets: ");

            // prints
            System.out.println("Alphabets entered: " + alpha);
        }

    }
}