Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>First problem</strong></p> <p>Always use <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#equals%28java.lang.Object%29" rel="nofollow">equals</a> when comparing Strings !</p> <p>What the <code>==</code> operator does is check if the objects are one and the same.</p> <p>The only reason this seems to work with Strings is because of something called <a href="http://javatechniques.com/blog/string-equality-and-interning/" rel="nofollow">interning</a>.</p> <p>This means that, unless the String constructor has been explicitly used, references with the same character sequence point to the same String object. This is to supposedly to reduce memory usage.</p> <p><strong>Second problem</strong></p> <pre><code>Exception in thread "main" java.util.ConcurrentModificationException </code></pre> <p>This is caused by modifying the structure you're iterating through using the enhanced for loop.</p> <p>This <a href="http://javaadami.blogspot.be/2007/09/enhanced-for-loop-and.html" rel="nofollow">link</a> explains why the Exception is thrown.</p> <blockquote> <p>In each next() method call of the iterator,</p> <pre><code> final void checkForComodification() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); } </code></pre> <p>method is called, to check if there is a chance is made in the list. This throws the ConcurrentModificationException in case they do not match.</p> </blockquote> <p><strong>Additional comments</strong></p> <p>For the sake of conventions which you seem to have partly respected you could rename your boolean variable from <code>PlayerIsAlive</code> to <code>isPlayerAlive</code>. This is in camelCase with a first minuscule and a "is" to immediately indicate to the reader that it's a true/false value.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload