学数据初始化程序老是出错。需要修改哪里》?以附代码。
public class ArrayDefaultValue { public static void main(String args[])
{
byte[]byteArray=new byte[1];
char[]charArray=new char[1];
int[]intArray=new int[1];
long []longArray= new long[1];
float []floatArray=new float[1];
double []doubleArray=new double[1];
String[]stringArray=new String[1];
System.out.println("byte+"byteArray[0]);
System.out.println("char+"charArray[0]);
System.out.println("int+"intArray[0]);
System.out.println("long+"longArray[0]);
System.out.println("float+"floatArray[0]);
System.out.println("double+"doubleArray[0]);
System.out.println("string+"stringArray[0]);
}
}
运行结果。这是什么意思?
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type of the expression must be an array type but it resolved to String
Syntax error on token "byteArray", delete this token
The type of the expression must be an array type but it resolved to String
Syntax error on token "charArray", delete this token
The type of the expression must be an array type but it resolved to String
Syntax error on token "intArray", delete this token
The type of the expression must be an array type but it resolved to String
Syntax error on token "longArray", delete this token
The type of the expression must be an array type but it resolved to String
Syntax error on token "floatArray", delete this token
The type of the expression must be an array type but it resolved to String
Syntax error on token "doubleArray", delete this token
The type of the expression must be an array type but it resolved to String
Syntax error on token "stringArray", delete this token
at ArrayDefaultValue.main(ArrayDefaultValue.java:12)