Last active
August 7, 2016 14:16
-
-
Save samundra/8581835c28b9ce3d8827 to your computer and use it in GitHub Desktop.
Instruction to compile java program from command line which resides inside package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filename : ConsolePassword.java | |
* @package : com.fivedots | |
* | |
* ConsolePassword is inside "Hello" project. Thus CD into the folder first, my case its "F:\workspace\Hello\" | |
* - cd F:\workspace\Hello | |
* - cd src | |
* - javac "com/fivedots/ConsolePassword.java" | |
* - java com.fivedots.ConsolePassword | |
**/ | |
import java.io.Console; | |
public class ConsolePassword { | |
public static void main(String[] args) { | |
Console cons = System.console(); | |
String username = cons.readLine("Enter username: "); | |
char[] passwd = cons.readPassword("Enter password: "); | |
System.out.println("Username :"+username); | |
System.out.println("password :"+passwd); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment