MFour interview question

Basic syntax in JAVA and coding approaches.