💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
1. 不要使用==来判断两个字符串是否相等,==只能判断两个字符串地址是否相同.当然字符串放在一个地址,他们必然相等.但是玩去哪有可能将内容相同的字符串放在不同的地址. ~~~ String str1 = "hello"; String str2 = "hello"; System.out.println(str1.substring(0, 3) == str2.substring(0, 3)); //false ~~~