I have string array name and string array company
public class Main {
public static void main(String[] args) {
String[] name = {"Alex", "John", "David", "Peter"};
String[] company = {"Adidas", "Nike", "New Balance", "Puma"};
Random random = new Random();
System.out.println(name[random.nextInt(name.length)] + " " + company[random.nextInt(company.length)]);
}
}
I've got
Alex Puma
That's OK, but I want print all randomed names and companies, such as
Alex Puma
Peter Nike
David New Balance
John Adidas
How to do it best way?
Aucun commentaire:
Enregistrer un commentaire