compiler errors - Beginning Java: Printing out a 5 pointed star using arrays -


i've been trying print out 5 pointed star keep on getting compile errors.

public class star  {     public static void main(string[] args)   {      int[][] star1 =new int[first][last];     int first = 5;     int last = 2;      for(int = 0; < 5; i++)     {        for(int j = 0; j < 2; j++)         (char) star1[i][j] == "*";          system.out.println(star1[i][j]);    }   }  } } 

these errors i'm getting:

exception in thread "main" java.lang.error: unresolved compilation problems:      first cannot resolved variable     last cannot resolved variable     syntax error on token ")", throw expected after token     incompatible operand types char , string     j cannot resolved variable @ star.main(star.java:7) 

i don't understand why can't (char) star1[i][j] == "*" how else can assign asterisk star1[i][j]?

i fixed compiler's errors:

public class star {   public static void main(string[] args){     int first = 5;     int last = 2; char[][] star1 =new char[first][last];   for(int = 0; < 5; i++) { for(int j = 0; j < 2; j++){   star1[i][j] = '*';  system.out.println(star1[i][j]); }    }   }  } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -