0% found this document useful (0 votes)
47 views3 pages

Method Mind Map

This document discusses methods in Java, including: 1. Types of methods - standard library methods like next() and sqrt() that are predefined, and user-defined methods created by the programmer. 2. The structure of a user-defined method includes the method name, return type, and parameters. 3. Method return types can be void if it doesn't return a value or can return a value of a specified type like int or String. 4. The general process of calling a method involves passing arguments from the caller, the method receiving the arguments and performing a task, and optionally returning a value.

Uploaded by

Farisha Azman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views3 pages

Method Mind Map

This document discusses methods in Java, including: 1. Types of methods - standard library methods like next() and sqrt() that are predefined, and user-defined methods created by the programmer. 2. The structure of a user-defined method includes the method name, return type, and parameters. 3. Method return types can be void if it doesn't return a value or can return a value of a specified type like int or String. 4. The general process of calling a method involves passing arguments from the caller, the method receiving the arguments and performing a task, and optionally returning a value.

Uploaded by

Farisha Azman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Method

L.O: a)Explain the meaning and the use of functions


b) Explain types of method: standard library and user defined.

Definition
Types of method
A collection of
statements that perform TYPES examples
some specific task and
return the result to the 1. • Built in method next();
caller Standard in Java that are nextInt ();
Library readily available sqrt (a)
Method for use pow (a,b)
Print ()

Advantages 2. User • Method that is class Classname {


public static void main(String[]
defined defined by the
i) Code reusability: You can args {
write method once and use it Method programmer }
multiple times void method1() { //method1
body
ii) Make code more readable }
and easier to debug
c) Explain the general structure of a user-defined method (method name, type,
parameters).
d) Explain method return types based on return values.

Method call Method definition

Return Value Pass Return value Receive value


arguments
void x x x

void / x /

/ x / x

/ / / /
Methods Definition and Call
a) Explain types and use of statements: method definition and method call.
b) Explain the general format of method definition and method call.
c) Construct non static user defined methods.
d) Construct programs that use standard and/or user-defined methods based on given
problem.

1. Sediakan bahan
Method
4. Output
Input in Main Method
If no return value, output in Method Body

If got return value, output in Main Method

2. Method call : Panggil, beri arahan dan


bahan (jika ada)
3. Terima arahan dan buat
objectname.methodname(arguments);
i. Method definition
-return type methodName(parameters)

ii. Process (Method body)

You might also like