package choose;
import java.util.Scanner;
public class Demo001 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入内容:");
String s = scanner.nextLine();
//判断字符串是否相等 equals
if(s.equals("Hello")){
System.out.println(s);
}
System.out.println("End");
scanner.close();
}
}
输出结果
请输入内容:
Hello
Hello
End
===================================
请输入内容:
ZXCVB
End