webguy08
10-21-2008, 02:41 AM
Hi all,
I am writing Java code where I would like the desired responses applied to the correct statments made by the user.
I have the following code, which works correctly:
public void chat(String talk)
{
String intro = "Hi"; **Local Variable**
if(talk.equals(intro)) {
System.out.println("(NLP): Hello.");
}
However, on the String intro = "Hi"; line I would like to include other words, as well as "Hi". However I do not know how. I have experimented with it; using || , + () etc. and haven't found a solution which works.
Can anyone help?
I am writing Java code where I would like the desired responses applied to the correct statments made by the user.
I have the following code, which works correctly:
public void chat(String talk)
{
String intro = "Hi"; **Local Variable**
if(talk.equals(intro)) {
System.out.println("(NLP): Hello.");
}
However, on the String intro = "Hi"; line I would like to include other words, as well as "Hi". However I do not know how. I have experimented with it; using || , + () etc. and haven't found a solution which works.
Can anyone help?