Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is a method in Java?
Look at the role it plays for class objects.
What syntax is used to declare a method?
Remember the structure with return type and method name.
What do methods define in a class?
Consider what verbs describe object actions.
True or False: Methods can return a value to the calling code.
Recall examples of methods that return data.
Modify the Car class to add a method changeColor(String newColor) and demonstrate how you would call this method.
Consider how you would implement changing an attribute's value.
Design a method compareYear(Car other) that compares the year of two Car objects and returns a string indicating which car is newer.
Think about using conditional statements to express comparisons.
6 more questions in this section. Enroll free to practise them all.
Enroll free