I need a java code for this question. can any one help me..?

Printable View