Question: Type in and run the following program. Then modify it to print Hello, name!, displaying the name that the user typed in. import javax.swing.JOptionPane; public

Type in and run the following program. Then modify it to print “Hello, name!”, displaying the name that the user typed in.


import javax.swing.JOptionPane;

public class DialogViewer
{
public static void main(String[] args)
{
String name = JOptionPane.showInputDialog("What is your name?");
System.out.println(name);
}
}

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The desired result could be achieved by concatenating Hello to the name and then again conce... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Concepts Late Objects Questions!