gpt4 book ai didi

JAVA - 当我进入过滤器或排序以离开它时,为什么我的 while 循环不会停止?

转载 作者:行者123 更新时间:2023-12-02 06:01:57 26 4
gpt4 key购买 nike

while((!(command.toLowerCase().contains("filter")==true) || 
!(command.toLowerCase().contains("sort")==true))){
System.out.println("Input is invalid. Please try again.");
command = range.nextLine();
}

最佳答案

您正在使用 || 进行检查,并且您的陈述之一将始终为真。尝试&&

关于JAVA - 当我进入过滤器或排序以离开它时,为什么我的 while 循环不会停止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22599460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com