i using netbeans ide , facing 1 small error , ruins everything. title suggests, compiler here assuming variable 'i' class instead of integer, though declared integer
public class playeroceangrid extends javax.swing.jframe { boolean play = false; boolean deploy = false; boolean vertical = true; boolean horizontal = false; boolean deploycarrier, deploycruiser, deploysubmarine, deploydestroyer, deploybattleship = false; boolean place = false; **int = 0;** int [] [] coordinate = new int [10] [10]; int randomr = (int) (math.random() * 10); int randomc = (int) (math.random() * 10); string [] shiptype = {"submarine", "cruiser", "carrier", "destroyer", "battleship"}; /* int randomtype = (int) (math.random() * 5); string finaltype = shiptype [randomtype]; */ char [] facing = {'h', 'v'}; /* int randomfacing = (int) (math.random() * 2); char finalfacing = facing [randomfacing]; */ int [][] coordinates = new int [10][10]; (i = 0; < 100; i++) { }
the compiler says
illegal start of type
cannot find symbol symbol: class location: playeroceangrid
identifier expected
and it's suggesting me create class named i, , that's not want. (i want 'i' used integer in loop!)
the real problem for
loop; isn't in method, constructor or initializer block. that's illegal expression.
void mymethod() { (i = 0; < 100; i++) { } }
but, isn't clear loop for
beyond that.
Comments
Post a Comment