Names Array Example

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); //scanner to read input //array lists of names String [] firstName = {"Tyler", "Noah", "Alex", "Andrew", "Xander", "Zak", "Troy"}; String [] lastName = {"Battrick", "Bender", "Davis", "Hillman", "Hughes", "Lecuyer", "Rodereque"}; //print out the REAL counted number from input //System.out.println(firstName[s.nextInt()-1] + lastName[s.nextInt()-1] ); System.out.println(firstName); } }
Editor Settings
Theme
Key bindings
Full width
Lines