Java Interview Logical Questions