showMessageDialog() expects an Object as its second argument. The object can be of any type but, as the API documentation says, "In the most common usage, message is just a String or String constant." http://java.sun.com/javase/6/docs/api/javax/swing/JOptionPane.html At the moment you are using recprint() which is a void method. You should be using a method that returns a reference to an Object (most ...