we use Scanner class to take user input in java as shown below example
incase text files we use BufferReader class to take input from user
import java.util.*;
class InputByUser {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
int a=sc.nextInt();//for integer
double b=sc.nextDouble();//for floating values
System.out.println(a);
}
}