Study

Java Methods

  •   0%
  •  0     0     0

  • Identify the method body in these codes.
    { int addition = x + y; return addition; }
  • It is just a combination of the method name and parameter list.
    Method Signature
  • What is the method name in this code?
    addNumbers
  • A ____________ in Java is a block of code that, when called, performs specific actions mentioned in it.
    method
  • This type of returnType has no value.
    void
  • You can only create a method within a class. (True or False?)
    True
  • Methods are used to perform certain actions, and they are also known as ____________.
    functions
  • How to call a method in Java?
    write the method's name followed by two parentheses () and a semicolon;
  • It is used to give a unique name to the method.
    Method Name
  • It is a list of arguments (data type and variable name) that will be used in the method.
    Parameter lists
  • This is the set of instructions enclosed within curly brackets that the method will perform.
    Method Body
  • Why use methods?
    To reuse code: define the code once, and use it many times.
  • This type of Access Specifier can be access within the class where it is defined.
    Private
  • What type of Access Specifier that can be access from any class?
    Public
  • What is the returnType in these codes?
    int (integer)
  • _________ means that the method belongs to the Main class and not an object of the Main class.
    static
  • Identify the Access Specifier used in this code.
    Public
  • It is used to define the access type of the method.
    Access Specifier