-1

I am new in Java and have one, I think, simple question on which I can not find an answer (May be my google is not working properly :) ).

I have a task to create some application, before it proceed to start, user should input some information in console, for example:

[devel@edu-cs-tpl bank_side]$  ./crypto.sh -i
Enter number of ZMK components (1 - 9): 2
Enter ZMK component 1: 1f1f1f1f1f1f1f1f2d2d2d2d2d2d2d2d
Enter ZMK component 2: 4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a
Enter ZEK under ZMK:

I am using java.util.Scanner to make this input. Is it possible on Java to "hide" the componnet inputed before last? I mean:

1)

[devel@edu-cs-tpl bank_side]$  ./crypto.sh -i
Enter number of ZMK components (1 - 9): 2
Enter ZMK component 1: 1f1f1f1f1f1f1f1f2d2d2d2d2d2d2d2d

2)

[devel@edu-cs-tpl bank_side]$  ./crypto.sh -i
Enter number of ZMK components (1 - 9): 2
Enter ZMK component 2: 4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a

Please advice how can i do that.

Thank you very much!

Juris
  • 86
  • 5
  • seems your question is wired. 1st one you are executing crypto.sh once but in 2nd you are doing each time. my answer is for second one. – vels4j Dec 08 '12 at 14:12
  • Do you mean just write over a previous line, or do you mean make it so the input is never since (like a password prompt). Under unix you could write a carriage return (`"\r"`) followed by lots of spaces to hide previous input. – Dunes Dec 08 '12 at 14:15
  • Please read [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) before attempting to ask more questions. –  Apr 12 '18 at 14:59

1 Answers1

-1

You can pass the argument at runtime by command line argument.

Also look at clear screen option in java Above link indicates there is no straight forward way to do what you are looking for.

Community
  • 1
  • 1
Achintya Jha
  • 12,267
  • 2
  • 25
  • 38