How get a string during run time???
I guess you are trying to ask how to get an input (string) from user which he enters through keyboard while program is running. Its simply reading from console.To read from keyboard BufferedReader class is used and its member readLine function is used.
public static void main (String args) throws IOException
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter lnput string ");
System.out.println("Input string was :"+str);
A Scanner can also be used .. it is specifically used to read a formatted input.You can check for it online.