Check out example codes for "java if statement string equals scanner". It will help you in understanding the concepts better.

Code Example 1

import java.util.Scanner;
Scanner scanner = new Scanner(Sys.in);

String x = scanner.nextLine();
if (x.equals("string")||x.equals("string 2")) {System.out.println("String 3");}

Learn ReactJs, React Native from akashmittal.com