编写一个JAVA简单的程序!
发布网友
发布时间:2023-11-07 08:59
我来回答
共3个回答
热心网友
时间:2023-12-20 22:57
public static void main(String[] args){
String firstString="This is";
String secondString="This is";
if(firstString==null && secondString==null){
System.out.println("①firstString 与 secondString 相等");
}else if(firstString!=null && firstString.equals(secondString)){
System.out.println("①firstString 与 secondString 相等");
}else{
System.out.println("①firstString 与 secondString 不相等");
}
String str = firstString + "his father";
System.out.println("②"+str);
System.out.println("③"+str.replaceAll("i", "z"));
}
热心网友
时间:2023-12-20 22:58
if (firstString.equals(secondString))
{
//相等
}
firstString +="his father"
secondString = secondString.replace('i','z')
热心网友
时间:2023-12-20 22:58
String firstString="This is";
String secondString="This is";
if(firstString.equals(secondString)){
System.out.println("相等");
}else{
System.out.println("不等");
}
System.out.println(firstString.concat(" his father"));
System.out.println(firstString.replace("i","z"));
}