Glossary
Dot Notation
Dot notation is the syntax used to call methods or access fields of an object or a class, using a dot (.) between the object/class name and the method/field name.
Example:
To make a Dog object named fido bark, you would use dot notation: fido.*bark*();
Execution Flow
Execution flow describes the order in which statements are executed in a program, particularly how the program jumps to a method's code when called and then returns to the calling point.
Example:
When game.*play*() is called, the execution flow moves into the play method, runs its code, and then returns to the line after the play() call.
Method
A method is a block of code that performs a specific task, essential for organizing code into reusable and modular blocks.
Example:
The calculateArea() method in a Circle class computes the area of the circle, making the code for area calculation reusable wherever a circle's area is needed.
Method Signature
The method signature consists of the method's name and its parameter list (the types and order of its inputs), which uniquely identifies the method to the compiler.
Example:
For public void setVolume(int level), the method signature is setVolume(int level), excluding the return type and access modifier.
Non-Static Method
A non-static method operates on a specific object and requires an instance of the class to be called.
Example:
If you have a Car object named myCar, you would call myCar.*accelerate*() to make that specific car accelerate.
Non-Void Method
A non-void method performs actions and returns a value of a specified data type.
Example:
A public double *getTemperature*() method might return the current temperature as a double value, which can then be used in calculations.
Parameters
Parameters are input values that a method can accept, which modify its behavior or provide data for its operations.
Example:
In public void setName(String *newName*), newName is a parameter that allows you to specify the name to be set for an object.
Static Method
A static method belongs to the class itself, rather than to any specific object of that class, and can be called directly using the class name.
Example:
The Math.*random*() method is a static method that generates a random number, called directly on the Math class.
Void Method
A void method performs actions but does not return any value. It typically changes the state of an object or performs an operation like printing.
Example:
The public void *printGreeting*() method might simply display 'Hello!' to the console without returning any data.