By LearnAllStudents Editorial Team. Source check dates are listed below.
Official resources
Trace before running the program
For String name = “Science”; int length = name.length(); the object is the string, the method call is name.length() and the int stored in length is 7. Keep the object type and return type in separate columns.
Try it yourself
Given String topic = “arrays”; what does topic.length() + 2 evaluate to?
Check your reasoning
8. The method returns the integer 6, and Java adds 2 to that return value.
How a tutor would approach this
Check where a return value goes. For a short program, underline each method call that returns something. Draw an arrow showing whether that value is stored, used in another expression or discarded.
Frequently asked questions
What is a receiver?
For an instance call, it is the object on which the method is called.
Is name.length a method call in Java?
For this String method, include the parentheses as in name.length().
Why track the return type?
It helps you see whether a value fits the assignment or surrounding expression.
What document sets the Unit 1 scope?
Use College Board’s current course framework rather than an older unit title.
Official sources
- College Board AP Computer Science A course framework (checked 2026-11-26)
- College Board comparison of both AP Computer Science courses (checked 2026-11-26)
Related pages
Try a free 30-minute demo
Work through a question with a tutor. No payment needed.
Request a free 30-minute demo