I'm trying to write a simple program that will search an array of string and output all the value which first sets of letters starts with what is in JTextfield

String[] words= {"apples", "applets", "ash", "bass", "banana", "cat", "chat", "coke"};what I want is when my textfield contains nothing all of the words would appear, if "app" then only apples and applets will be displayed.

Check Solution