While I'm not sure what behavior you seek with the program, do you want the 'if' when comparing post2 and post3 to be 'else if'?

P.S. No need to call System.exit(0)...the main method exits by...