I am writing a program that takes a user input and depending on their answer gives them a different answer. How do I use a string that the user entered with an if - else statement?
I have this so far:
import java.io.*;
import static java.lang.System.*;
import java.util.Scanner;
class t1_lesson07_template{
     public static void main (String str[]) throws IOException {
              Scanner scan = new Scanner(System.in);
              System.out.print("Hello, welcome to the companion planting guide. ");
              System.out.print("Lets get started! To begin, just input the desired plant in the box to learn what plants to grow with it!");
              String plant = scan.nextLine();
              if (plant == "Asparagus") {
                System.out.print("Tomatoes, parsley, and basil.");
              }
     }
}
I am wondering about the syntax for the if statement in this case.
 
     
     
     
     
    