From d56f4a18a511a5b10db031efbaa56782afd96976 Mon Sep 17 00:00:00 2001 From: TuanHo10102003 Date: Sat, 28 Dec 2024 14:23:52 +0700 Subject: [PATCH] Update NameDialog.java --- examples/ch03/Fig03_13/NameDialog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ch03/Fig03_13/NameDialog.java b/examples/ch03/Fig03_13/NameDialog.java index 8b3e2b9..2467314 100644 --- a/examples/ch03/Fig03_13/NameDialog.java +++ b/examples/ch03/Fig03_13/NameDialog.java @@ -7,11 +7,11 @@ public class NameDialog public static void main(String[] args) { // prompt user to enter name - String name = JOptionPane.showInputDialog("What is your name?"); + int age = JOptionPane.showInputDialog("What is your age?"); // create the message String message = - String.format("Welcome, %s, to Java Programming!", name); + String.format("Welcome, %d, to Java Programming!", age); // display the message to welcome the user by name JOptionPane.showMessageDialog(null, message);