SELLinALL Interview Question

Java Programming and logic question