One way of getting input from a user is to use stuff already built into java, and this is known as a scanner. A scanner takes input from a user (keyboard) and stores it as a variable.
// we need to import the Scanner, if we // don't import it, we cannot use it. import java.util.Scanner; class jamesprogram { public static void main(String args[]){ // make variable that will hold the input from // the keyboard. So whatever we input into // the system, will be stored in the variable // froggy Scanner froggy = new Scanner(System.in); System.out.println(froggy.nextLine()); } }
The use of nextLine() after froggy. causes the program to wait until it receives input from froggy (i.e. the system has received input)