pw = "" + scan.nextLine();

You could have skipped the redundent part:


"" +

Scanner (Java 2 Platform SE 5.0)