hy cant i keep the parameters in the encrypt method as
private String encrypt(String word, int key)
Why do i have to use a new variable called str? I have kept the key variable the same why not the variable word?
I'm not sure I understand what you are asking.
You can give just about any name you want to the parameters received by a method:
private String encrypt(String theWordToWorkOn, int theKeyThatWillBeUsed)
It is usually better and less confusing if the variable names local to a method are unique to that method and NOT the same as class variables. If they have the same names, the class variables are "shadowed" and not used. This can be a problem if you forget which variable you are using. You could think you are setting a class variable but are really working with a local one. When the method exits, the class variable is unchanged.
Unique names prevents this problem.