This example uses the Scanner class for input (not JOptionPane).
Below are two Java programs that do exactly the same thing.

String handling methods using a one class program and multiple static variables and methods. Therefore no parameter passing needed.

Click here.

==================================================================

String handling methods using a two class program and multiple non-static methods that pass parameters.

Click here for the UI class

Click here for the template/object class