I'm new into JAVA and I'm not sure how to break a the DO WHILE loop that I use in my code below? I thought I could enter -1 to break or all other numbers to continue the loop.
import javax.swing.*;
public class Triangel {
public static void main(String[] args) {
int control = 1;
while (control == 1){
String value = JOptionPane.showInputDialog("Enter a number or -1 to stop");
if(value == "-1"){
control = 0;
}
System.out.println(value);
}
}
}