{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "17dcafe1edc8444ea6cea1bb82bbac67",
  "keywords": "算法初阶,最小值和最大值,排序和顺序统计量,中位数和顺序统计量",
  "title": "按要求编写字符界面",
  "desc": [
    {
      "content": "\n编写一个字符界面的Java Application 程序，接受用户输入的10个整数，并输出这10个整数的最大值和最小值。",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "java"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ]
  ],
  "template": {
    "content": "import java.util.Scanner;\npublic class MaxMin {\n\tpublic static void main(String[] args) {\n\t\tArrays array = new Arrays();\n\t\tarray.setArr();\n\t\tint max=array.getMax();\n\t\tint min=array.getMin();\n\t\tSystem.out.println(\"数组中最大值=\"+max);\n\t\tSystem.out.println(\"数组中最小值=\"+min);\n\t}\n}\nclass Arrays {\n\tprivate int[] arr;\n\tpublic Arrays() {\n\t\tarr = new int[10] ;\n\t\tfor(int i = 0; i<arr.length;i++) {\n\t\t\tarr[i] =0;\n\t\t}\n\t}\n\tpublic void setArr() {\n\t\tScanner sc = new Scanner(System.in);  \n\t\tSystem.out.println(\"请输入数组元素的值：\");  \n\t\tarr = new int[10] ;\n\t\tfor(int i = 0; i<arr.length;i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t}\n\tpublic int getMax() {\n\t\tint max = arr[0];\n\t\tfor(int i : arr) {\n\t\t\tif(max < i)\n\t\t\t\tmax = i;\n\t\t}\n\t\treturn max; \n\t}\n\tpublic int getMin() {\n\t\tint min= arr[0];\n\t\tfor(int i : arr) {\n\t\t\tif(min > i)\n\t\t\t\tmin= i;\n\t\t}\n\t\treturn min; \n\t}\n}",
    "language": "java"
  },
  "node_id": "dailycode-1ca616758e884630bac67b234def92c8",
  "license": "csdn.net",
  "created_at": 1637894161,
  "topic_link": "https://bbs.csdn.net/topics/600470281"
}