String buttons[] = {"button1", "button2", "button3", "default"}; JOptionPane.showOptionDialog(null,"Message","Title",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,null, buttons,"default");


whenever I type a if statement, it gives me an error under the buttons.
if (buttons = "button1"){
}

how do I make the error go away.

buttons is an array. You cannot compare it to a string.

You need a separate string variable, say, button, to receive the input, and then you can compare.

Plus, "=" is the assignment operator. You probably meant to use "==", which is the logical comparison operator.

if (button == "button1") { ...

Clearly, you are just starting out, so be sure to consult java's excellent online documentation frequently.