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()
Try this. hope this will help.
String cls0; String cls1; Scanner in = new Scanner(System.in); System.out.println("Enter a string"); cls0 = in.nextLine(); System.out.println("Enter a string"); cls1 = in.nextLine();