but not getting the same output with when I use s = reader.readLine(); line 24. s = reader.readLine(); this is causing entire program to crash. Tried with Scanner also.