问题
This gives me an error of:
Cannot define dimension expressions when an array initializer is provided.
How to fix it?
static String names[] = new String[8]{
"Global Mining Technologies",
"Advanced Mine Group",
"Hi-Tech Mining Industrial",
"Victory Mining Co.",
"Miners of Land Inc.",
"Space-Age Mining Industries",
"EasyMine Co.",
"C.R.A.F.T Mining"};
回答1:
It's exactly as the error mentions. Either you specify dimensions and don't initialize inline, or you don't specify dimension and are allowed to initialize elements.
Use this idiom instead:
static String names[] = {
"Global Mining Technologies",
"Advanced Mine Group",
"Hi-Tech Mining Industrial",
"Victory Mining Co.",
"Miners of Land Inc.",
"Space-Age Mining Industries",
"EasyMine Co.",
"C.R.A.F.T Mining"};
来源:https://stackoverflow.com/questions/33503396/error-in-simple-array-how-to-fix