Learn how to read a method, call it correctly, and use Java's built-in tools with confidence.
Click the choices and see how one order becomes a method call.
The real-world pattern comes first: choose, customize, receive.
In Java, the pattern is still tool, inputs, and result.
orderDrink names the tool. drink stores the result. A method is a named tool that does a job or gives a result.
A method signature shows return type, name, and parameters.
For each signature, describe the name, parameter count, parameter types, and return type.
Do not guess. Read the tools first.
Java already gives you many ready-made tools.
Math for calculations. abs()pow()sqrt()String methods for text. length()substring()equals()Scanner for keyboard input. nextInt()nextDouble()nextLine()These methods belong to the class, so we call them with the class name and a dot.
static. Java gives you ready-made methods for common calculations
Each Math call gives back a value, and that value has a type.
For each line, decide what value is stored in the variable.
Generate a random number from 1 to 6.
Java starts with a random decimal between 0.0 and 1.0.
For each line, decide which integers the variable could store.
Key ideas for methods, APIs, and the Math class
A method is a named tool that does a job or gives back a result.
A signature shows the return type, method name, and parameters.
Some methods return a value like int or double, and some use void.
Math methods are class methods, so we call them with the class name, a dot, and the method name.