You have defined the newStudent inside the addStudent() and you are accessing the newStudent in showSubject(). This is the root of problem.
Either pass newStudent to showSubject() or declare...