import java.io.*;
class Exp6_2
{
  public static void main(String[] args)
  {
      String def_pswrd = "admin";
      String pswrd;
      try
      {
          InputStreamReader isr = new InputStreamReader(System.in);
          BufferedReader br = new BufferedReader(isr);
          System.out.print("Enter the Password : ");
          pswrd = br.readLine();
          if( def_pswrd.equals(pswrd) )
          {
              System.out.println("Good");
              pswrd = pswrd.concat("Welcome to Java!!!");
              System.out.println("\nConcatinated Password : "+pswrd);
              System.out.println("\nReverse Password : ");
              for(int i= pswrd.length()-1;i>=0;i--)
              {
                  System.out.print(pswrd.charAt(i));
              }
              pswrd = pswrd.replace( '!' , '*' );
              System.out.println("\nFormatted Password : "+pswrd);
          }
          else
          {
              System.out.println("Incorrect Password");
          }
      }
      catch(Exception e)
      {
          System.out.println("IOException Error!");
      }
  }
}
No comments:
Post a Comment