What this deck covers
This deck focuses on Methods How To Write Them, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Study Methods How To Write Them in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
Which option correctly calls a method named 'display' with an int parameter?
Tap card or press Space to flip
display(5). Proper method call syntax with parentheses and argument.
How well did you know it?
Card 1 / 73
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on Methods How To Write Them, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: display(5). Proper method call syntax with parentheses and argument.
Answer: compute(). Parentheses are required even when no parameters are passed.
Answer: Use double quotes: 'return "Hello";'. String values must be enclosed in double quotes.
Answer: To initialize a new object of a class. Special method called when creating new class instances.
Answer: Use double quotes: "Hello". String literals require double quotes, not single quotes.
Answer: To uniquely identify a method with its name and parameters. Distinguishes methods by combining name with parameter types.
Answer: Parameters are in the method declaration, arguments are in the call. Parameters define method interface; arguments are actual values passed.
Answer: The entry point of a Java application: 'public static void main(String[] args)'. Special method where program execution begins in Java applications.
Answer: By changing the number or type of parameters. Different parameter signatures enable method overloading.
Answer: Specifies the visibility of the method to other classes. Controls which classes can access and use the method.
Answer: Use the 'throws' keyword in the method declaration. Declares potential exceptions that may occur during execution.
Answer: static. Enables calling methods without instantiating the class.
Answer: Each parameter must have a type: 'int x, int y'. Parameter 'y' is missing its data type declaration.
Answer: Parameters are in the method declaration, arguments are in the call. Parameters define method interface; arguments are actual values passed.
Answer: To be implemented by subclasses in an abstract class. Forces subclasses to provide concrete implementation.
Answer: Add parameter: '(String[] args)'. Main method requires String array parameter for command-line arguments.
Answer: By changing the number or type of parameters. Different parameter signatures enable method overloading.
Answer: Use 'String[] args' for the parameter. The main method requires proper array syntax for command-line arguments.
Answer: Constructors do not have a return type. Constructors initialize objects and don't return values explicitly.
Answer: Use the 'throws' keyword in the method declaration. Declares potential exceptions that may occur during execution.
Answer: Add curly braces: '{ return a + b; }'. Method body requires curly braces to contain executable code.
Answer: To uniquely identify a method with its name and parameters. Distinguishes methods by combining name with parameter types.
Answer: Specifies the type of value the method returns. Declares what kind of data the method will return.
Answer: A method that calls itself. Solves problems by breaking them into smaller, similar subproblems.
Answer: Use double quotes: "Hello". String literals require double quotes, not single quotes.
Answer: compute(). Parentheses are required even when no parameters are passed.
Answer: To declare the method's access, return type, and parameters. Defines method signature including visibility and parameter information.
Answer: Each parameter must have a type: 'int x, int y'. Parameter 'y' is missing its data type declaration.
Answer: Contains the block of code that executes when the method is called. Defines the executable statements that run when method is invoked.
Answer: Contains the block of code that executes when the method is called. Defines the executable statements that run when method is invoked.
Answer: The number and types of parameters. Ensures proper method invocation with correct argument types.
Answer: Remove 'return 5;' since return type is void. Void methods cannot return values, only perform actions.
Answer: Defining multiple methods with the same name but different parameters. Enables multiple methods with same name but different parameter lists.
Answer: Add parameter: '(String[] args)'. Main method requires String array parameter for command-line arguments.
Answer: For methods that perform actions but do not return values. Suitable for operations like printing or modifying object state.
Answer: return. Exits the method and sends a value back to the caller.
Answer: Specify parameter types: 'int a, int b'. Parameters must include data types for compilation.
Answer: Use Javadoc comments: '/** ... */'. Standard documentation format for generating API documentation.
Answer: To refer to the current object instance. Distinguishes instance variables from parameters or local variables.
Answer: To exit a method and optionally return a value. Controls method flow and passes data back to caller.
Answer: A variable listed in the method's declaration. Receives values when the method is called.
Answer: Constructors do not have a return type. Constructors initialize objects and don't return values explicitly.
Answer: accessModifier returnType methodName(parameters) { body }. Standard Java method structure with access modifier, return type, name, and parameters.
Answer: Use Javadoc comments: '/** ... */'. Standard documentation format for generating API documentation.
Answer: Remove 'return 5;' since return type is void. Void methods cannot return values, only perform actions.
Answer: For methods that perform actions but do not return values. Suitable for operations like printing or modifying object state.
Answer: Providing a new implementation for an inherited method. Subclass provides specific implementation for inherited abstract method.
Answer: To refer to the current object instance. Distinguishes instance variables from parameters or local variables.
Answer: final. Prevents subclasses from overriding the method implementation.
Answer: The method belongs to the class, not instances of the class. Can be called using the class name without creating objects.
Answer: A variable listed in the method's declaration. Receives values when the method is called.
Answer: accessModifier returnType methodName(parameters) { body }. Standard Java method structure with access modifier, return type, name, and parameters.
Answer: Types and names of variables passed to the method. Defines what data the method accepts as input.
Answer: The number and types of parameters. Ensures proper method invocation with correct argument types.
Answer: Add curly braces: '{ return a + b; }'. Method body requires curly braces to contain executable code.
Answer: Use double quotes: 'return "Hello";'. String values must be enclosed in double quotes.
Answer: The entry point of a Java application: 'public static void main(String[] args)'. Special method where program execution begins in Java applications.
Answer: Allows different implementations for different parameter lists. Provides flexibility by supporting various parameter combinations.
Answer: A method that calls itself. Solves problems by breaking them into smaller, similar subproblems.
Answer: display(5). Proper method call syntax with parentheses and argument.
Answer: To be implemented by subclasses in an abstract class. Forces subclasses to provide concrete implementation.
Answer: Specifies the type of value the method returns. Declares what kind of data the method will return.
Answer: To declare the method's access, return type, and parameters. Defines method signature including visibility and parameter information.
Answer: return. Exits the method and sends a value back to the caller.
Answer: Specify parameter types: 'int a, int b'. Parameters must include data types for compilation.
Answer: static. Enables calling methods without instantiating the class.
Answer: Specifies the visibility of the method to other classes. Controls which classes can access and use the method.
Answer: To exit a method and optionally return a value. Controls method flow and passes data back to caller.
Answer: Allows different implementations for different parameter lists. Provides flexibility by supporting various parameter combinations.
Answer: Types and names of variables passed to the method. Defines what data the method accepts as input.
Answer: Use 'String[] args' for the parameter. The main method requires proper array syntax for command-line arguments.
Answer: The method belongs to the class, not instances of the class. Can be called using the class name without creating objects.
Answer: final. Prevents subclasses from overriding the method implementation.