Create three arrays of type double. Do a compile-time initialization and place

different values in two of the arrays. Write a program to store the product of the
two arrays in the third array. Produce a display using the MessageBox class
that shows the contents of all three arrays using a single line for an element from
all three arrays. For an added challenge, design your solution so that the two
original arrays have a different number of elements. Use 1 as the multiplier when
you produce the third array

Sure! Here's an example program in Java that demonstrates how to create three arrays of type double, initialize two of them with different values, and store the product of the two arrays in the third array. It uses the `JOptionPane` class instead of `MessageBox` class to display the array contents:

```java
import javax.swing.JOptionPane;

public class ArrayProductExample {
public static void main(String[] args) {
double[] array1 = {1.5, 2.0, 3.5}; // First array initialization
double[] array2 = {2.5, 1.2}; // Second array initialization
double[] array3 = new double[array1.length + array2.length]; // Third array initialization

// Store product of array1 and array2 in array3
for (int i = 0; i < array1.length; i++) {
for (int j = 0; j < array2.length; j++) {
array3[i + j] += array1[i] * array2[j];
}
}

// Display the contents of all three arrays in a single line
StringBuilder message = new StringBuilder("Array1: ");
for (double element : array1) {
message.append(element).append(" ");
}

message.append("Array2: ");
for (double element : array2) {
message.append(element).append(" ");
}

message.append("Array3 (product): ");
for (double element : array3) {
message.append(element * 1.0).append(" ");
}

JOptionPane.showMessageDialog(null, message);
}
}
```

This program first creates two arrays, `array1` and `array2`, with different lengths and initializes them with some values. Then, it creates the third array, `array3`, with a length equal to the sum of the lengths of `array1` and `array2`.

Next, the program uses nested loops to calculate the product of each element from `array1` and `array2` and stores the results in corresponding positions of `array3`. The inner loop iterates over `array2` for each element in `array1`, ensuring that each combination of elements is multiplied.

Finally, the program builds a string message that includes the contents of all three arrays. It uses a `StringBuilder` to efficiently append the values of each array to the message in a single line. The `JOptionPane.showMessageDialog()` method displays the message in a dialog box.

Remember to import the necessary `javax.swing.JOptionPane` class before running the program.