I'm a high school student beginning in java and I don't know how to print something if the first of half of a string contains the word "the" and how to print something different if its in the second half of the string and if its not in the string something different as well. here is my code so far:
String sentnc = (JOptionPane.showInputDialog("What is the message?"));
int a = sentnc.length();
if (sentnc.contains("the"))
{
txa1.setText("the enemy is attacking tonight");
}
This is in a button action performed tab.
Any help would be appreciated.