2. Write a program to let the user capture personal details : names, address, telephone, age, city, then display them. Use both “readline� and “showInputDialog� functions.

To write a program that captures personal details from the user and displays them using both the "readline" and "showInputDialog" functions, you can follow these steps:

Step 1: Import the necessary module
Start by importing the "javax.swing.JOptionPane" module in order to use the "showInputDialog" function.

```java
import javax.swing.JOptionPane;
```

Step 2: Use "readline" to capture personal details
Next, use the "readline" function to capture personal details such as name, address, telephone, age, and city from the user. Prompt the user to input each detail and store the values in respective variables.

```java
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class PersonalDetails {
public static void main(String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

try {
System.out.print("Enter your name: ");
String name = reader.readLine();

System.out.print("Enter your address: ");
String address = reader.readLine();

System.out.print("Enter your telephone: ");
String telephone = reader.readLine();

System.out.print("Enter your age: ");
String age = reader.readLine();

System.out.print("Enter your city: ");
String city = reader.readLine();

// Display the captured personal details
System.out.println("Personal Details:");
System.out.println("Name: " + name);
System.out.println("Address: " + address);
System.out.println("Telephone: " + telephone);
System.out.println("Age: " + age);
System.out.println("City: " + city);
} catch (IOException e) {
e.printStackTrace();
}
}
}
```

Step 3: Use "showInputDialog" to capture personal details
Now, use the "showInputDialog" function from the "JOptionPane" class to capture personal details such as name, address, telephone, age, and city from the user. The input dialog will be displayed as a popup window.

```java
import javax.swing.JOptionPane;

public class PersonalDetails {
public static void main(String[] args) {
String name = JOptionPane.showInputDialog(null, "Enter your name:");

String address = JOptionPane.showInputDialog(null, "Enter your address:");

String telephone = JOptionPane.showInputDialog(null, "Enter your telephone:");

String age = JOptionPane.showInputDialog(null, "Enter your age:");

String city = JOptionPane.showInputDialog(null, "Enter your city:");

// Display the captured personal details
JOptionPane.showMessageDialog(null, "Personal Details:\n"
+ "Name: " + name + "\n"
+ "Address: " + address + "\n"
+ "Telephone: " + telephone + "\n"
+ "Age: " + age + "\n"
+ "City: " + city);
}
}
```

Note: The "showInputDialog" function returns a String, so all the captured personal details will be stored as Strings in the corresponding variables.

Compile and run the above program, and you'll be able to capture personal details using both the "readline" function and the "showInputDialog" function, and then display them accordingly.