int num;
num = in.nextInt();
String array[] = new String[num];
for (int i = 0; i < num; i++) {
    array[i] = in.next();
    if (array[i].equals("hey guys"))
        System.out.println("hey guys");
    else
        System.out.println("buzz");
}
This is the code i tried. When i remove the space in "hey guys", it works allright but otherwise it doesn't.
 
     
     
     
    