www.wfdy.net > JAVA初学求帮助,流程控制与数组方面,输入的一个数...

JAVA初学求帮助,流程控制与数组方面,输入的一个数...

public static void main(String[] args) { int[] gradeArr = new int[5]; Scanner input = new Scanner(System.in); for (int i = 0; i < 5; i++) { System.out.println("请输入第"+(i+1)+"学生成绩!"); int grade = input.nextInt(); while (...

完整的代码如下: public class Demo01 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int[] a = new int[10];int i = 0;// 输入10个整数while (true) {a[i] = sc.nextInt();i++;if (i == 10) {break;}}// 冒...

public class Test {private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));public static String getString(){try {return br.readLine();} catch (IOException e) {return "";}}public static int getInt...

BufferedReader reader = null; try{ reader = new BufferedReader(new FileReader(new File("D:\\abc.txt"))); while(true){ String s = reader.readLine(); System.out.println(s); } //这是从外部文档中读文件的,从键盘一般不用它,至少我没...

package question.baidu; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int[] array = new int[5]; int max = 0; int temp = 0; for (int i = 0; i < 5...

Scanner input = new Scanner(System.in);System.out.print("输入您要找的数:");int number = input.nextInt();int numbers = 0;int [] array = {2,4,5,5,8,9};for(int i = 0 ; i < array.length ; i++){if(number == array[i]){numbers = i+1...

import java.util.Scanner; public class Students{ public static void main(String[] xiawei){ Scanner input=new Scanner(System.in); int[] result=new int[5];//用来存放五5学生成绩的数组 int sum=0;//用来存放5位学生的总成绩 int averag...

import java.util.Scanner; public class Main1 { public static void main(String ars[]){ Scanner s=new Scanner(System.in); System.out.println("请输入数组行数和列数"); int x=s.nextInt(); int y=s.nextInt(); int [][]awarry=new int[x]...

public class Test {private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));public static String getString(){try {return br.readLine();} catch (IOException e) {return "";}}public static int getInt...

import java.util.Arrays;import java.util.Random;public class Main {public static void main(String[] args) {int [][]data = new int[2][3];Random r = new Random();data[0][0] = r.nextInt(101);data[0][1] = r.nextInt(101);data[0][2] ...

网站地图

All rights reserved Powered by www.wfdy.net

copyright ©right 2010-2021。
www.wfdy.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com