Note that there are some explanatory texts on larger screens.

plurals
  1. PO2 errors with Java program
    primarykey
    data
    text
    <p>So, I'm working on this code for my Java class and I came to this issue that is bugging me, Sorry if it's a bit long, I'm new to Java coding. </p> <pre><code>import javax.swing.*; public class DebugEight4 { public static void main(String[] args) { int x = 0, y; String array[] = new String[100]; String entry; final String STOP = "XXX"; StringBuffer message = new StringBuffer("The words in reverse order are\n"); entry = JOptionPane.showInputDialog(null, "Enter any word\n" + "Enter " + STOP " when you want to stop"); while(!(entry.equals(STOP))) { array[STOP] = entry; entry = JOptionPane.showinputDialog(null, "Enter another word\n" + "Enter " + STOP + " when you want to stop"); } for(y = 0; y &gt; 0; ++y) { message.append(array[y]); message.append("\n"); } JOptionPane.showMessageDialog(null, message); } } </code></pre> <p>I'm getting a DebugEight4.java:17: error: ')' expected "Enter " + STOP " when you want to stop"); (Arrow points to the space between STOP and " ) ^</p> <p>DebugEight4.java:17: error: illegal start of expression "Enter " + STOP " when you want to stop"); (arrow points to the ')' ) ^ </p> <p>DebugEight4.java:23: error: ')' expected ("Enter " + STOP + " when you want to stop"); (Arrow points to the ;) ^ </p> <p>This is all one problem, and another problem I'm getting is with this:</p> <p>DebugEight4.java:20: error: incompatible types array[STOP] = entry; required: int found: String (aarow points to STOP</p> <p>DebugEight4.java:21: error: cannot find symbol entry = JOptionPane.showinputDialog(null, symbol: method </p> <p>Sorry for this long post, but as I said I'm new to this and would like some help with this, thanks everyone!</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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