New course! Every coder should learn Generative AI!
Try a free lesson+ 1
1. Import the Scanner Class : import java.util.Scanner;
2. Create an object of the class : Scanner Obj = new Scanner(System.in);
3. Read user input : String userInput = Obj.nextLine();
Then the user input will be stored in "userInput" and you can use it in a condition, to display, ...
I didn't get what you mean by "access to the other class".
Hope this will help.