Are you looking for this? As you asked about getting input via command line so if you run your java program via command line and want to pass it some inputs, they are received by args
parameter in main
. look here
Echoing Command-Line Arguments
The Echo example displays each of its command-line arguments on a line by itself:
public class Echo {
public static void main (String[] args) {
for (String s: args) {
System.out.println(s);
}
}
}