You now have 2 main methods. Both are entry points for the program. Since they must exchange information, it does not make sense that you have both.
I would recommend changing the main Output method to an instance method, taking one parameter: weight from Input .
Same:
public void printOutput(final double weight){
Then you can call this from the main Input method as follows:
public static void main(String[] args) { String weight; weight = JOptionPane.showInputDialog("Enter weight in kilograms"); double kg = Double.parseDouble(weight);
Another thing, since Output is currently used for only one method, you can simply move this method to Input .
source share