How to take user input in Java Program

Learn About How to take User Input In JAVA. We are providing you a java application that will communicate with the user at the command line and returns the user input.

import java.io.*;
public class UserInput
{
public static void main(String[] args)
{
try
{
DataInputStream in = new DataInputStream(System.in);
System.out.print(“Enter Data :- “);
String UserData = in.readLine();
System.out.println(“Now, You Enter ==>” + UserData);
}
catch(Exception e)
{
System.out.println(e);
}
}
}