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 Util{ public static void main(String[] args){ java.util.Scanner sc = new java.util.Scanner(System.in); String[] arr = new String[5]; for(int i = 0; i < arr.length; i++){ arr[i] = sc.next(); } //这里使用util.Arrays...

完整的代码如下: 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...

public class test {public static void main(String[] args){int ou_count=0,ji_count=0;int num[]={'0','1','2','3'};//数组初始化for(int i=0;i

看你的代码,求数组平均数的方法没错. 但是你输入一组数到数组的方法是错的,你仅仅只是输入了一个数而已.

很高兴回答你的问题,下边是根据你的需求写的一段代码: public static void main(String[] args) { int[] arr = new int[10]; int count = 0; Scanner scan = new Scanner(System.in); while(count

package date; import java.util.Scanner; import java.util.Arrays; public class TestScanIn { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int[] nums = new int[5]...

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

网站地图

All rights reserved Powered by www.wfdy.net

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