Say I have a following function in java, may be not good example but just came in mind ;)
public StudentEntity updateStudent(StudentEntity studentEntity)
{
    studentEntity.setName(...);
    studentEntity.setAddress(...);
    return studentEntity;
}
Is above approach valid?
Can we store a studentEntity in separate variable and update and return it. For example
public StudentEntity updateStudent(StudentEntity studentEntity)
{
    StudentEntity _studentEntity = studentEntity;
    _studentEntity.setName(...);
    _studentEntity.setAddress(...);
    return _studentEntity;
}
Is this correct ? How mutator methods should be? Please make me correct if wrong!
 
     
    