본문 바로가기
이전글/2007

SCJP를 따볼까?

by 물개선생 2007. 4. 29.
아래 코드의 8번째 줄에서 NullPointerException이 발생했다면 뭐가 잘못되었을까요?

1:    public String toString()
2:    {
3:         String retValue = "";
4:         retValue = "StudProf ( "
5:             + super.toString() + TAB
6:             + "studProfId = " + this.studProfId + TAB
7:             + "stud = " + this.stud == null? "" : this.stud.getStudId() + TAB
8:             + "prof = " + this.prof == null? "" : this.prof.getEmpId() + TAB
9:             + "type = " + this.type == null? "" : this.type + TAB
10:             + " )";
11:         return retValue;
12:    }


정답은..