create account

Java Programming with Official-Hord - Understanding Java methods by official-hord

View this thread on: hive.blogpeakd.comecency.com
· @official-hord ·
$2.47
Java Programming with Official-Hord - Understanding Java methods
A method is simply a collection of one or more staments in a group to carry out a task.
For example, if we say System.out.println(), the 'System' in the statement executes several tasks but when you add the remaining part of the statement.. ".out.println();" the combinationn carries out the function of displaying a message in the console.

Methods can be default or created by you the programmer depending on what you want to achieve, you can design your method to return a value or not and furthermore.

Few factors to be put in consideration when creating your own methods;
- Modifier: This could be private, or public
- Return Type: This is the data type expected to be returned by the method created or invoked.
- Name of method: Any name can be given to a method, provided it is not a default name in java.
- Formal Parameters: These are parameters to be used in the method.
- List of parameters; This is the parameters to be used and the datatype which they belong to.

Syntax for creating your method
`public/private static/void `(modifier) `double/int/string`(return type) `division`(Method name)``(double a, double b(Parameter List)){
//What method does or rather body
}
``

This would make a sample like:
````
public static double division(double x, double y,){
double z = y/x;
return z;
}
````

This method would return the value of z which is the division of x and y.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorofficial-hord
permlinkjava-programming-with-official-hord-understanding-java-methods
categoryutopian-io
json_metadata{"tags":["utopian-io","programming","science","steemstem","genesisproject"],"app":"steemit/0.1","format":"markdown"}
created2018-03-14 14:58:12
last_update2018-03-14 14:58:12
depth0
children0
last_payout2018-03-21 14:58:12
cashout_time1969-12-31 23:59:59
total_payout_value1.920 HBD
curator_payout_value0.546 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,381
author_reputation8,938,440,857,429
root_title"Java Programming with Official-Hord - Understanding Java methods"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id44,390,264
net_rshares774,391,062,782
author_curate_reward""
vote details (34)