Java: First user-defined method in java to calculate square of a number