add q1 & q2 files, added java code for q2