The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

I need help with METHODS!!!

No matter how many times I've been explained the theory behind methods, I can't determine how to write them to apply to programs. Here is a simple program that work, but I need to apply 4 different methods to it.

setUsername() – A mutator method that sets the username for the associated account. (Use any
8 letters to represent the initial username.)

getPassword() - An accessor method that asks for the password associated with the account.

//Setting the correct user name
String user = new String("muzukashi");

//Setting the correct password
String pass = new String("Ja57pan");

//Boolean expression to check if what the person entered is correct for both username and password
if(user.equals(x) && pass.equals(y)){

//Displays a message to inform them that they entered both correctly
JOptionPane.showMessageDialog(null,"Valid user Name","Good job!", JOptionPane.WARNING_MESSAGE);
}
else{
//Informs the user that they entered something wrong, but not actually telling them
JOptionPane.showMessageDialog(null,"Invalid user Name","Dumbass", JOptionPane.WARNING_MESSAGE);
}