I want to know when to use get and set methods(getName,setName ) in my class and when simple classVariable.name = "" instead а = classVariable.getName()
Here is example of class using set and get methods
public class ClassExampe {
    String name;
    String course;
    public String getName ( )
    {
        return name;
    }
    public void setName (String studentName)
    {
        name = studentName;           
    }
    public String getCourse ( )
    {
        return course;
    }
    public void setCourse (String studentCourse)
    {
        course = studentCourse;
    }
}
Thanks
 
     
     
     
     
     
     
     
     
     
     
    