日期:2014-05-20 浏览次数:20642 次
import java.util.*; public class Test { public static void main(String[] args) { int[][] procedure = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) { if (procedure[i][j] > 7) System.out.println("Value found was \"" + procedure[i][j] + "\" at [" + i + "][" + j + "]"); } } }
------解决方案--------------------
import java.util.*; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("请输入最大数:"); int maxValue = in.nextInt(); System.out.print("请输入最小数:"); int minValue = in.nextInt(); System.out.print("请输入一个数:"); double tmp = in.nextDouble(); while (tmp < minValue || tmp > maxValue) { System.out.print("请输入一个数:"); tmp = in.nextDouble(); } System.out.println(tmp); } }