java if statement string equals scanner

Java
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");}
Source

Also in Java: