When I gave n=3, I can only Input 2 names, actully I should be able to give three names.
import java.util.*;
public class whoshouldpay {
public static void main(String[] args)
{
Scanner getem=new Scanner(System.in);
System.out.println("\nHow many members:\t");
int n=getem.nextInt();
String Names[]=new String[n];
System.out.println("\nEnter the names\t");
for (int i=0;i<n;i++)
{
Names[i]=getem.nextLine();
}
Random random=new Random();
int rand_num=random.nextInt(n);
System.out.println("\n"+Names[rand_num]+" Should pay the bill");
}
}