Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- public class a {
- public static void main(String[] args) {
- String firtstName = enterName();
- String secondName = enterName();
- JOptionPane.showMessageDialog(null, firtstName + System.lineSeparator() + secondName);
- }
- private static String enterName() {
- String name = "";
- boolean isCorrect = false;
- while (!isCorrect) {
- try {
- name = JOptionPane.showInputDialog(null, "Enter Name");
- Double.parseDouble(name);
- JOptionPane.showMessageDialog(null, "Enter Name Again");
- } catch (Exception igonred) {
- JOptionPane.showMessageDialog(null, "Correnct - " + name);
- isCorrect = true;
- }
- }
- return name;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement