David Coello wrote:I would like the database to be integrated with the main program and when the user enters a keyword like "job", or "hello", to retrieve and present that containing phrase from the database. I know I need some kind of array, a match or search and match, and a random function to choose an a reply.
OK, well, what you've written for your "database" contents looks very much like an array to me, and it's an array where each element contains an array of 4 Strings (ie, an array of arrays); so how do you think that might be defined in Java? (actually, there's more than one answer).
As far as the random function goes, have a look at the Random class (java.util.Random).
It's the search part I don't quite follow; what are you supposed to search for? You mention a keyword, but don't really explain how it's used.
Also:
1. Class names should start with a CAPITAL letter; so it should be
StartChat, not
startChat.
2. You've defined a field called 'comline' and then don't do anything with it. What's it for?
3.
You should generally avoid constructs like
while(true) if you can. It's not a 100% rule, but see if you can think of a condition where you want the loop to stop instead.
HIH
Winston