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.
author | official-hord |
---|---|
permlink | java-programming-with-official-hord-understanding-java-methods |
category | utopian-io |
json_metadata | {"tags":["utopian-io","programming","science","steemstem","genesisproject"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-03-14 14:58:12 |
last_update | 2018-03-14 14:58:12 |
depth | 0 |
children | 0 |
last_payout | 2018-03-21 14:58:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.920 HBD |
curator_payout_value | 0.546 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,381 |
author_reputation | 8,938,440,857,429 |
root_title | "Java Programming with Official-Hord - Understanding Java methods" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 44,390,264 |
net_rshares | 774,391,062,782 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
eric-boucher | 0 | 13,578,085,096 | 4% | ||
ogoowinner | 0 | 193,013,409,860 | 45% | ||
michelios | 0 | 4,648,298,991 | 1.6% | ||
oluwatobiloba | 0 | 13,979,964,653 | 100% | ||
illuminatus | 0 | 13,286,176,250 | 50% | ||
ehiboss | 0 | 237,203,664,855 | 60% | ||
camzy | 0 | 6,643,777,007 | 100% | ||
smallville | 0 | 284,646,898 | 8% | ||
evelyniroh | 0 | 1,392,034,100 | 8% | ||
esteemguy | 0 | 135,053,475 | 8% | ||
emergehealthier | 0 | 734,272,833 | 4% | ||
littlefairy | 0 | 189,829,560 | 8% | ||
creativity101 | 0 | 59,775,018 | 8% | ||
official-hord | 0 | 3,147,767,984 | 100% | ||
creon | 0 | 6,375,190,026 | 100% | ||
bollutech | 0 | 97,012,002 | 0.8% | ||
genesis-project | 0 | 274,227,973,224 | 8% | ||
otemzi | 0 | 148,369,141 | 0.8% | ||
sammarkjames | 0 | 116,658,234 | 8% | ||
rebeccafl | 0 | 81,699,054 | 8% | ||
fabiocola | 0 | 57,219,390 | 8% | ||
perlo | 0 | 155,150,920 | 8% | ||
markaustin | 0 | 193,835,362 | 5% | ||
kolaolabode | 0 | 998,916,692 | 100% | ||
berylwills | 0 | 77,055,926 | 8% | ||
victoryudofia | 0 | 88,754,415 | 8% | ||
steepup | 0 | 144,423,420 | 15% | ||
blaize-eu | 0 | 785,580,766 | 75% | ||
mrferanmi | 0 | 60,010,911 | 4% | ||
ferrylee | 0 | 59,899,156 | 4% | ||
kemisola | 0 | 60,008,282 | 4% | ||
kolaola | 0 | 1,720,975,495 | 100% | ||
dasilva | 0 | 60,561,712 | 4% | ||
dollypee | 0 | 585,012,074 | 100% |