Friday 15 January 2010

java - Local variable not updated in loop -


I created an object array and then started the array within a loop. But when I call a method with object array, it tells me, the variable has not been started. What did I do wrong and how do I get it right?

  objects [] = object; For (int i = 0; i & lt; someMap.size (); i ++) {object = new object [someMap.size ()]; (Entry E: someMap.entrySet) for {object [i] = new object (var1, var2, var3); }} Somemethod (some, object); // eclipse tells me: the local variable object may not have started    

Just make this change:

  objects [] object = zero;   

That's because, you are starting your array for loop in. But the compiler does not know that compiling time, so it says time error Compile it. somemethod / html>

No comments:

Post a Comment