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) {
        Console console = System.console();

        char passwordArray[] = console.readPassword("Enter your secret password: ");
        console.printf("Password entered was: %s%n", new String(passwordArray));
    }
}