How can I read something from command prompt using java.

System.in is the standard input stream that java supplies to get input from the console. I usually use code that looks like this:

BufferedReader input = new BufferedReader( new InputStreamReader( System.in ) );

Then use the readLine() method in the BufferedReader class to read each line of input. For more info, check out the java api.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.