Professional Documents
Culture Documents
0 03-June-2020
Creating Methods
1. Explain the purpose of a method. Define the terms
invoke, method call, calling method and called method,
arguments, parameters, and return type.
Explanation: The invoke () method of Method class Invokes the
underlying method represented by this Method object, on
the specified object with the specified parameters.
Individual parameters automatically to match primitive
formal parameters. Both primitive and reference
parameters are subject to method invocation conversions
as necessary.
Teaching Tip: Note that method identifiers follow the same naming rules as other Java
identifiers.
1. Review the example code in Figure 6.2, which contains a
static method.
Pictu
re
PANGASINAN STATE UNIVERSITY 617 .. 5
. Pictur
e
618 ...
Study Guide in FM-AA-CIA-15 Rev. 0 03-June-2020
}
Teaching Tip: Note that method identifiers follow the same naming rules as other Java
identifiers.
Quick Quiz 1:
____Method_____ 1.
A(n) __________ is a program module that contains a series
of statements that carry out a task.
______False_____ 2. True or False: The method declaration is the first line, or
header, of a method.
______A 3. The full name of the nameAndAddress() method is
dot_____ First.nameAndAddress();. The full name includes the class
name, a(n) ____, and the method name.
Pictu
re
PANGASINAN STATE UNIVERSITY 617 .. 6
. Pictur
e
618 ...
Study Guide in FM-AA-CIA-15 Rev. 0 03-June-2020
Pictu
re
PANGASINAN STATE UNIVERSITY 617 .. 7
. Pictur
e
618 ...
Study Guide in FM-AA-CIA-15 Rev. 0 03-June-2020
Teaching Tip: If a method does not have a return type (declared using the void
keyword), the return statement can be used followed by a semicolon to return program
execution to the calling method.
3.
Discuss the benefits of using classes, including
Pictu
re
PANGASINAN STATE UNIVERSITY 617 .. 8
. Pictur
e
618 ...
Study Guide in FM-AA-CIA-15 Rev. 0 03-June-2020
reusability.
Explanation: Java programmers concentrate on crafting new classes
and reusing existing classes. Many class libraries exist,
and others are being developed worldwide. Software is
then constructed from existing, well-defined, carefully
tested, well-documented, portable, widely available
components. This kind of software reusability speeds the
development of powerful, high-quality software. Rapid
application development (RAD) is of great interest today.
Java programmers now have thousands of classes in the
Java API from which to choose to help them implement
Java programs. Indeed, Java is not just a programming
language. It is a framework in which Java developers can
work to achieve true reusability and rapid application
development. Java programmers can focus on the task at
hand when developing their programs and leave the
lower-level details to the classes of the Java API.
Teaching Tip: The Java language provides a large number of built-in classes that are
used to create programs. There are also open-source projects, such as Jakarta Commons,
that provide other prewritten classes that can be used within programs. When writing a
program, it is a good idea to see whether a prewritten class contains functionality that
can be used rather than “reinventing the wheel.”
For easy tracking of your file/s strictly follow the correct filename format given below.
Filename: Output Checking:
LastnameFirstNameMI_M6_Act1.docx none
e.g. DelacruzJuanL_M6_Act1.docx