import java.util.Scanner; //package Sponge; class Patrick_Solution { String address; String [] hobbies; public Patrick_Solution(int N) { Scanner in = new Scanner(System.in); address = "120 Conch Street"; hobbies = new String[N]; //super(); for(int i = 0 ; i < N ; i++) { String str = in.next(); hobbies[i] = str; } in.close(); } public String getAddress() { return address; } public static void main (String [] args) { Patrick_Solution p = new Patrick_Solution ( 10); int k = 10; Scanner entry = new Scanner (System.in); //Reading from System.in will always have a next input, it's from the keyboard. You need to make a flagged exit--like if the return String is an empty string, "". // while(entry.hasNextLine()) while(entry.equals("")) { String question = entry.nextLine(); if ( question.equals("Is this the Krusty Krab?")) System.out.println("No! This is Patrick"); } for ( k = 10; k > 0; k = k-1) { System.out.printf("Who are you people? \n"); } } }