package project6;
import java.util.Arrays;
import java.util.Scanner;
public class Hello{
int[] price;
int num;
static String name;
Scanner input=new Scanner(System.in);
public Hello(){
for(int i=0;i<num;i++){
System.out.println("请输入第"+(i+1)+"个"+name+"笔的价格");
price[i]=input.nextInt();
}
System.out.println(name+"笔的价格为:"+Arrays.toString(price));
}
{
num=3;
}
static{
name="英雄";
}
public static void main(String args[]){
Hello a=new Hello();
}
}
数组price[] 没有初始化大小