객체이름@16진수해시코드
형식으로 출력public class StudentVO{
private String name;
private int age;
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public int getAge(){
return age;
}
public void setAge(int age){
this.age = age;
}
@Override
public String toString(){
return "StudentVO[name="+name+", age="+age+"]";
}
}
public class Test{
public static void main(String[] args){
StudentVO studentVO = new StudentVO();
studentVO.setName("홍길동");
studentVO.setAge(27);
System.out.println(studentVO.toString());
}
}
출력값: StudentVO [name=홍길동, age=27]
오버라이딩 없이 실행 시: 패키지경로.StudentVO@2d484fb3