java 中array的问题

来源:百度知道 编辑:UC知道 时间:2024/07/07 10:59:17
public class Bowl
{
static char choice='x';
static int i=0;
static int[] score1= new int[10];
static int[] score2= new int[10];
static int[] score3= new int[10];
static int[] score4= new int[10];
static int[] score5= new int[10];
static double[] ave= new double[10];
static int[] total= new int[10];
static int[] low=new int[10];
static int[] high=new int[10];
static String[] bowlName= new String[10];
这是什么啊 有没有能把它简单话的方法啊
看不懂啊
那个[10] 不是 范围吗 要每都要加[10]吗
为什么要 加 STATIC

static int[] score1= new int[10];
static int[] score2= new int[10];
static int[] score3= new int[10];
static int[] score4= new int[10];
static int[] score5= new int[10];
这五句可以简化一下

static int[][] score= new int[5][10];
但是相应代码也要改

static 的意思是静态的意思,静态的意思就是说类可以调这个数组,而不需要new 一个对象.

static int[][] score= new int[5][10];
但是相应代码也要改

额 貌似楼上的回答完了 我就逛下吧 他们的都是对的