想问一下这是什么意思该怎样在代码中不出现“TO”的实现,代码希望有详尽的注释,刚刚入门的小学生
4条回答 默认 最新
- qq_51439533 2022-10-09 16:35关注
public static void main(String[] args) {
String Str = new String("Welcome to Gench ");
String Str1 = new String("to");
System.out.print("返回值 :" );
String Str2 =Str.substring(0,16);//截取
System.out.println(Str2.replace("to",Str1.toUpperCase()));//TO替换to,并打印
}本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用