some java code for exam