Prevent Negative numbers for Age without using client side validation.
- by Deepak
Hi People,
I have an issue in Core java.
Consider the Employee class having an attribute called age.
class Employee{
private int age;
public void setAge(int age);
}
My question is how do i restrict/prevent setAge(int age) method such that it accepts only positive numbers and it should not allow negative…