help im new to this....
why are get method useful?? for example
why write this:
public class name {
private String yourname;
public void setname(String Fname){
yourname= Fname;
}
public String getname(){
return yourname;
}
public void sayying(){
System.out.printf("hello %s", getname());
}
}
when this also does the same thing
private String yourname;
public void setname(String Fname){
yourname= Fname;
}
public void sayying(){
System.out.printf("hello %s", yourname);
}