hi,
I am working on one project for performance enhancement. I had one doubt, while we are during a process, we tend to trace the current state of the DTO and entity used. So, for this we have included toString() method in all POJOs for the same. I have now implemented toString() in three different ways which are following :-
public String toString() {
return "POJO :" + this.class.getName() + " RollNo :" + this.rollNo + " Name :" + this.name;
}
public String toString() {
StringBuffer buff = new StringBuffer("POJO :").append(this.class.getName()).append(" RollNo :").append(this.rollNo).append(" Name :").append(this.name);
return buff.toString();
}
public String toString() {
StringBuilder builder = new StringBuilder("POJO :").append(this.class.getName()).append(" RollNo :").append(this.rollNo).append(" Name :").append(this.name);
return builder .toString();
}
can anyone please help me to find out which one is best and should be used for enhancing performance.