Java Program for String and String Buffer class

Write a Java program to implement a program to accomplish the following task using string / string buffer class :

i. Accept a password from user.
ii. Check if password is correct then display 'Good' else display 'Password is incorrect'
iii. Append the password with the string 'Welcome to Java!!!'
iv. Display the password in reverse order.
v. Replace the character '!' in password with '*' character.

Source Code
import java.lang.*;

public class StringActivity {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(;
		String s1 = "admin!";
		String s2;
		System.out.println ("Enter Password");
		s2 = br.readLine();
		if(s1.compareTo(s2)==0) {
			System.out.println ("Good");
		else {
			System.out.println ("Password is incorrect");
		String s3 = "Welcome to Java!!!";
		StringBuffer sb = new StringBuffer(s1);
		System.out.println ("Appended Password = "+sb);
		StringBuffer s4 = new StringBuffer(s1);
		System.out.println ("String in Reverse Order = "+s4);
		System.out.println ("Replaced '!' with '*' = "+s1.replace('!','*'));	
Enter Password
Appended Password = admin!Welcome to Java!!!
String in Reverse Order = !nimda
Replaced '!' with '*' = admin*