at the top of my class i have
private static String SECRET_KEY = "";
how do i read a key and set it to SECRET_KEY?
if (SECRET_KEY == "") {
System.out.println("Please enter a secre key which both the client and server will share:");
}
Printable View
at the top of my class i have
private static String SECRET_KEY = "";
how do i read a key and set it to SECRET_KEY?
if (SECRET_KEY == "") {
System.out.println("Please enter a secre key which both the client and server will share:");
}
Through System.in. You might want to wrap an InputStreamReader and a BufferedReader around it to read a single line of input.
Thanks bud. any chance you can give me an e.gQuote:
Originally Posted by CornedBee
Some stuff to import from java.io.Code:BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String line = r.readLine().trim();
awesome thanks bud.
so i just simply do
SECRET_KEY = line;
?
Yeah, or you read directly into SECRET_KEY.