Solved Question2 Write Java Code For The Following

Solved Question2 Write Java Code For The Following