Method Basics
Method Types
Access Modifiers
Parameters & Return Types
Miscellaneous
100

What is the keyword used to define a method in Java?

void (or any return type)

100

What method type does not return any value?

void method

100

What is the most restrictive access modifier?

private

100

What is the difference between a parameter and an argument?

A parameter is in the method definition, an argument is the actual value passed

100

What is the name of the method that Java automatically calls when running a program?

main method

200

What is the term for calling a method inside another method?

Method invocation

200

What type of method belongs to the class itself rather than instances?

static method

200

What access modifier allows a method to be accessed from any class?

public

200

What keyword is used to specify the type of data a method returns?

The return type (e.g., int, double, String)

200

What does System.out.println() do?

Prints text to the console

300

What part of a method defines its name, parameters, and return type?

Method signature

300

A method that calls itself is called what? (This is a harder one!)

Recursive method

300

What access modifier allows access to methods within the same package but not outside?

default (package-private)

300

What keyword is used to return a value from a method?

return

300

What is the difference between static and instance methods?

Static methods belong to the class, instance methods belong to objects

400

What is the process of defining multiple methods with the same name but different parameters?

Method overloading

400

A method that only returns a computed value and does not modify fields is called what?

Pure method

400

What access modifier allows access in subclasses even if they are in different packages?

protected

400

If a method returns an int, but a double is returned instead, what will happen?

A compilation error

400

What is an abstract method?

A method without a body, meant to be implemented in subclasses

500

True or False: Methods in Java must always belong to a class.

True

500

What term describes a method that runs when an object is first created?

Constructor

500

What happens if you don’t specify an access modifier in Java?

The method gets default (package-private) access

500

True or False: A method can return multiple values in Java.

False (but can return an array or an object containing multiple values)

500

What keyword prevents a method from being overridden in a subclass?

final

M
e
n
u