No seguinte código:
`import javax.swing.JOptionPane;
public class Musicas {
public static void main(String[] args) {
String lista = "Lista de músicas:";
for (byte numero = 1; numero <= 3; numero++) {
String str, artista = "", musica = "";
while (true) {
str = "Música " + numero + ": nome do artista";
str = JOptionPane.showInputDialog(null,str);
if (str == null) break;
artista = str.trim().toUpperCase();
if (artista.length() < 2 || artista.length() > 30) {
str = "O nome informado é inválido!";
JOptionPane.showMessageDialog(null,str,"Erro",0);
continue;
}
break;
}
if (str == null) break;
while (true) {
str = "Música " + numero + ": nome da música";
str = JOptionPane.showInputDialog(null,str);
if (str == null) break;
musica = str.trim().toLowerCase();
if (musica.length() < 5 || musica.length() > 40) {
str = "O nome informado é inválido!";
JOptionPane.showMessageDialog(null,str,"Erro",0);
continue;
}
break;
}
if (str == null) break;
lista += "\n" + artista + " - " + musica;
}
JOptionPane.showMessageDialog(null,lista);
System.exit(0);
}
}
`
Se str for igual a null, pare. << null nesse programa faz o quê?
e também o o artista recebe o str.trim() << O trim() faz o quê?
Grato