package welcome;
import java.util.Scanner;
public class 字符串基础 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
String s = new String("Hello");
//字符串的连接
System.out.println(s+12+24);
System.out.println(s+(12+24));
System.out.println();
//读入字符串
String m;
m = in.nextLine();
System.out.println(m);
m =in.next();
System.out.println(m);
System.out.println();
//关于字符串相等的比较
String n;
n = in.next();
System.out.println(n);
System.out.println(n == "bye");
System.out.println(n.equals("bye"));
}
}
字符串基础
最新推荐文章于 2022-03-31 00:00:27 发布