has structure for java be given one line at a time, but it is giving null pointer exception