五芒星を出力しようとしましたが、コンパイル エラーが発生し続けます。
public class star
{
public static void main(String[] args)
{
int[][] star1 =new int[first][last];
int first = 5;
int last = 2;
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 2; j++)
(char) star1[i][j] == "*";
System.out.println(star1[i][j]);
}
}
}
}
これらは私が得ているエラーです:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
first cannot be resolved to a variable
last cannot be resolved to a variable
Syntax error on token ")", throw expected after this token
Incompatible operand types char and String
j cannot be resolved to a variable at star.main(star.java:7)
(char) star1[i][j] == "*"
他にどのようにアスタリスクを に割り当てることができますstar1[i][j]
か?と言えない理由がわかりません。