Dear Java Programmer:
The Student class has the following constructor and method.
/**Creates a new instance of Student*/
public Student(){
this.studentRecord = new StudentRecord();
}//Student constructor
/**Returns the name of the student*/
public String getStudentName(){
return studentRecord.getName();
}//getName
/**Changes the name of the student*/
public void setStudentName(String tempStudent){
studentRecord.setName(tempStudent);
}//setStudentName
The getStudentName class makes a static call to studentRecord which
contains the getName method.
Question:
What is returned to getStudentName?
Is the value of the string sent back or is a reference to the string
being sent.
I tried writing this method by putting the return into a temp variable
which also worked.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---