public class StringDemo{
public static void main(String[] args){
String text="hello";
System.out.println("字符串内容: "+text);
System.out.println("字符串长度:"+text.length());
System.out.println("等于hello? "+text.equals("hello"));
System.out.println("转为大写: "+text.toUpperCase());
System.out.println("转为小写: "+text.toLowerCase());
}
}
本文通过一个简单的Java程序演示了如何使用字符串进行基本的操作,包括获取字符串长度、比较字符串、转换字符串大小写等。
283

被折叠的 条评论
为什么被折叠?



