import javax.swing.*;
public class Prova
{	public static void main (String[] args)
	{	String str, str1; int n=0; double d=0, s;
		str = JOptionPane.showInputDialog
				("Scrivi un numero intero:");
		str1 = JOptionPane.showInputDialog
				("Scrivi un numero reale:");
		try {	n = Integer.parseInt(str);
					d = Double.parseDouble(str1);
				}
		catch (NumberFormatException e)
		{	Console.scriviStringa(e.getMessage());
			System.exit(1);
		}
		// la gestione dell’ecccezione non e` obbligatoria
		s = n + d;
	 	JOptionPane.showMessageDialog
			(null, "Somma: " + s, "Risultato della somma",
			 JOptionPane.INFORMATION_MESSAGE);
		System.exit(0);
	}
}
