Just recently started using linux for one of my college modules and was wondering if anybody could help with this small problem. Take this tiny sample program for example, just to show you what i mean:

public class Word
{
	public static void main(String[] args)
	{
		int count=0;
		String word;
		System.out.println("Enter words:");
		while(!Console.endOfFile())
		{
			word = Console.readString();
			count++;
		}
		System.out.println("You entered "+count+" words.");
	}
}

On windows, if i run this in the command prompt and press ctrl+c, it will print the results. How do i do this in this linux terminal? Because when i press ctrl+c or ctrl+z it will stop the program but print nothing.