I have been struggling with setters and getters in java for quite a long time now.
For instance, if I want to write a class with some information as name, sex, age
You create an object by instantiating the constructor as follows
Personinfo pi = new Personinfo("Anna", "female", "17");
You can then call methods upon that object as follows
pi.setName("Alan");
or
pi.getName();