2.5 Calling a Non-void Method
Enduring Understanding
Some objects or concepts are so frequently represented that programmers can draw upon existing code that has already been tested, enabling them to write solutions more quickly and with a greater degree of confidence.
Learning Objective
Call non-static non-void methods with or without parameters.
Essential Knowledge
Non-void methods return a value that is the same type as the return type in the signature. To use the return value when calling a non-void method, it must be stored in a variable or used as part of an expression.
Previous2.4 Calling a Void Method with ParametersNext2.6 String Objects: Concatenation, Literals, and More
Last updated
Was this helpful?