3个回答
展开全部
import java.util.Scanner;
public class Test2 {
public static void main(String[] args) {
double[] myAry ={35, 23, 234, 165};
System.out.print("Please input a number: ");
double input = new Scanner(System.in).nextDouble();
boolean isFound = false;
for(int i = 0; i < myAry.length; i++){
if(myAry[i] == input){
isFound = true;
break;
}
}
System.out.println(input + " can " + (isFound? "": " not ") +" be found in the ary");
}
}
public class Test2 {
public static void main(String[] args) {
double[] myAry ={35, 23, 234, 165};
System.out.print("Please input a number: ");
double input = new Scanner(System.in).nextDouble();
boolean isFound = false;
for(int i = 0; i < myAry.length; i++){
if(myAry[i] == input){
isFound = true;
break;
}
}
System.out.println(input + " can " + (isFound? "": " not ") +" be found in the ary");
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询