197k views
3 votes
Assume that another method has been defined that will compute and return the student's class rank (Freshman, Sophomore, etc). It is defined as: public String getClassRank( ) Given that s1 is a student, which of the following would properly be used to get s1's class rank?A) S1 = getClassRank( );B) S1.toString( );C) S1.getHours( );D) S1.getClassRank( );E) GetClassRank(s1);

User Kyanna
by
5.8k points

1 Answer

3 votes

Answer:

Option (D) i.e., s1.getClassRank( ); is the correct option to the following question.

Step-by-step explanation:

Here, in the following option, the object "S1" is the object of the class "rank" and "getClassRank( )" is the function of that class "rank". so, in the following code the function "getClassRank( )" is called through the class object which computes and returns the class rank of the students.

So, that's why the following option is the correct way to call the function.

User Daniel Alder
by
5.9k points