So today I think of updating my blog with the basic idea of reading input from console which is very simple.Here I have implemented console class for this purpose.
The complete java code looks like this:
import java.io.Console;
/**
*
* @author 0v3rr!d3
*/
public class console {
public static void main(String []a)
{
Console conn;
conn=System.console();
if (conn == null)
{
System.out.println("No console available");
}
String name;
name=conn.readLine("Name: ");
System.out.println("You typed: " + name);
}
}
The above program takes input name from the user and then displays what the user has typed. Enjoy it... Please leave a comment if you experienced any problem.. regarding this..
No comments:
Post a Comment