I am trying to use Console class to get input from user but a null object is returned when I call System.console(). Do I have to change anything before using Sy
System.console()
Found some good answer here regarding reading from console, here another way use 'Scanner' to read from console:
import java.util.Scanner; String data; Scanner scanInput = new Scanner(System.in); data= scanInput.nextLine(); scanInput.close(); System.out.println(data);