Methods, contracts and test cases: Concept map and vocabulary

36 min
0/4 practice checks

Methods, contracts and test cases: Concept map and vocabulary

A Java method gives one carefully defined job a name. Parameters state the inputs, a return value states the result, and a contract lets another programmer use the method without reading every line inside it.

Learning move. In this lesson, connect the essential terms and distinguish their roles before attempting a solution.

Worked example. A calculateAverage method receives marks and returns one number. It should not also print a report, change a learner record and open a file: those are separate jobs that can be tested independently.

Which statement best reflects this lesson's method contract?

Write the key term for this lesson: method contract.

A school system needs a reliable next step. Which choice is most defensible for this topic?

A learner can repeat a definition from Methods, contracts and test cases: Concept map and vocabulary. Which next task gives stronger evidence of mastery?