What is the keyword used to define a method in Java?
void (or any return type)
What method type does not return any value?
void method
What is the most restrictive access modifier?
private
What is the difference between a parameter and an argument?
A parameter is in the method definition, an argument is the actual value passed
What is the name of the method that Java automatically calls when running a program?
main method
What is the term for calling a method inside another method?
Method invocation
What type of method belongs to the class itself rather than instances?
static method
What access modifier allows a method to be accessed from any class?
public
What keyword is used to specify the type of data a method returns?
The return type (e.g., int, double, String)
What does System.out.println() do?
Prints text to the console
What part of a method defines its name, parameters, and return type?
Method signature
A method that calls itself is called what? (This is a harder one!)
Recursive method
What access modifier allows access to methods within the same package but not outside?
default (package-private)
What keyword is used to return a value from a method?
return
What is the difference between static and instance methods?
Static methods belong to the class, instance methods belong to objects
What is the process of defining multiple methods with the same name but different parameters?
Method overloading
A method that only returns a computed value and does not modify fields is called what?
Pure method
What access modifier allows access in subclasses even if they are in different packages?
protected
If a method returns an int, but a double is returned instead, what will happen?
A compilation error
What is an abstract method?
A method without a body, meant to be implemented in subclasses
True or False: Methods in Java must always belong to a class.
True
What term describes a method that runs when an object is first created?
Constructor
What happens if you don’t specify an access modifier in Java?
The method gets default (package-private) access
True or False: A method can return multiple values in Java.
False (but can return an array or an object containing multiple values)
What keyword prevents a method from being overridden in a subclass?
final