A method is like a function in java that makes your code look clear, concise, readable and reusable. You can say it is a collection of statements, instructions or code designed to perform some specific functions. Methods may or may not have parameters passed to them and have their own return type. ``` package Lesson1; public class Method { public static void main(String[] args) { addition(2,3); addition(5,6); multiplication(4,5); } public static void addition(int a, int b) { System.out.println(a+b); } public static void multiplication(int a, int b) { System.out.println(a*b); } } ``` This is the sample output of the above code: <center>  </center> This is how code would've looked if we hadn't used the method. ``` public class WithoutMethod { public static void main(String[] args) { int a=2; int b=3; System.out.println(a+b); int c=5; int d=6; System.out.println(c+d); int e=4; int f=5; System.out.println(e*f); } } ``` What if we have to print let's say thousands of this statement, then instead of typing such long codes, methods come to our aid by making our code readable and reusable.
author | leoumesh |
---|---|
permlink | concept-of-methods-in-java-programming |
category | hive-122108 |
json_metadata | {"tags":["hive-122108","java","programming","code","coding","tutorial","method"],"image":["https://images.hive.blog/DQmZwUqTSTJP3PkgoxXEc8iM4NrD24CuvGgaNuKKTSpPK5f/Screenshot_1.png"],"app":"hiveblog/0.1","format":"markdown"} |
created | 2020-06-26 07:21:33 |
last_update | 2020-06-26 07:21:33 |
depth | 0 |
children | 3 |
last_payout | 2020-07-03 07:21:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 2.856 HBD |
curator_payout_value | 2.422 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,264 |
author_reputation | 212,340,493,251,438 |
root_title | "CONCEPT OF METHODS IN JAVA PROGRAMMING" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,184,148 |
net_rshares | 15,749,648,825,853 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tombstone | 0 | 15,821,422,885 | 0.75% | ||
onealfa | 0 | 27,371,899,996 | 1.25% | ||
logic | 0 | 397,546,413,118 | 100% | ||
steemcleaners | 0 | 6,084,928,738,416 | 100% | ||
alishi | 0 | 31,382,874,456 | 50% | ||
mys | 0 | 3,547,614,034 | 1% | ||
whd | 0 | 1,202,311,348 | 1% | ||
themarkymark | 0 | 2,222,877,597,777 | 10% | ||
tykee | 0 | 1,782,380,021 | 37% | ||
maulida | 0 | 506,013,022 | 100% | ||
buildawhale | 0 | 5,277,306,111,962 | 10% | ||
therealwolf | 0 | 760,312,199,180 | 2.5% | ||
makerhacks | 0 | 11,374,039,735 | 10% | ||
smartsteem | 0 | 331,823,430,484 | 2.5% | ||
upmyvote | 0 | 8,046,313,063 | 10% | ||
fun2learn | 0 | 5,771,288,558 | 3.3% | ||
bala41288 | 0 | 36,470,573,279 | 14.8% | ||
tobias-g | 0 | 6,187,368,636 | 7.5% | ||
leoumesh | 0 | 36,300,383,741 | 100% | ||
ipromote | 0 | 3,137,273,167 | 10% | ||
angelinafx | 0 | 201,853,093 | 5.7% | ||
digital.mine | 0 | 162,201,797,756 | 1% | ||
jk6276 | 0 | 0 | 1% | ||
gorbisan | 0 | 1,196,793,164 | 0.75% | ||
chrisamuda | 0 | 1,511,235,783 | 100% | ||
laissez-faire | 0 | 82,202,724 | 100% | ||
epicdice | 0 | 6,323,757,668 | 0.75% | ||
tinyhousecryptos | 0 | 533,021,021 | 5% | ||
delegate4food | 0 | 554,173,436 | 45% | ||
bilpcoinbpc | 0 | 1,338,089,417 | 50% | ||
hivewatchers | 0 | 199,828,671,744 | 65% | ||
thepeakstudio | 0 | 61,351,141,289 | 100% | ||
gitplait | 0 | 49,851,971,638 | 74% | ||
food.bot | 0 | 977,870,242 | 28.35% |
I think I need this
author | chrisamuda |
---|---|
permlink | qclcau |
category | hive-122108 |
json_metadata | {"app":"hiveblog/0.1"} |
created | 2020-06-27 15:28:09 |
last_update | 2020-06-27 15:28:09 |
depth | 1 |
children | 1 |
last_payout | 2020-07-04 15:28:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 19 |
author_reputation | 17,040,057,630,088 |
root_title | "CONCEPT OF METHODS IN JAVA PROGRAMMING" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,207,890 |
net_rshares | 0 |
You are in the perfect place then I am just a beginner🙂
author | leoumesh |
---|---|
permlink | qcmml3 |
category | hive-122108 |
json_metadata | {"app":"hiveblog/0.1"} |
created | 2020-06-28 08:07:57 |
last_update | 2020-06-28 08:07:57 |
depth | 2 |
children | 0 |
last_payout | 2020-07-05 08:07:57 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 55 |
author_reputation | 212,340,493,251,438 |
root_title | "CONCEPT OF METHODS IN JAVA PROGRAMMING" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,219,081 |
net_rshares | 0 |
Defining a function is important in any language. Thanks for making a nice java tutorial. We are looking for people like you in our community. <sub> Your post has been submitted to be curated with @gitplait community account because this is the kind of publications we like to see in our community. </sub> Join our [Community on Hive](https://hive.blog/trending/hive-103590) and Chat with us on [Discord](https://discord.gg/CWCj3rw). [[Gitplait-Team]](https://gitplait.tech/)
author | gitplait-mod1 |
---|---|
permlink | qcj9kq |
category | hive-122108 |
json_metadata | {"users":["gitplait"],"links":["https://hive.blog/trending/hive-103590","https://discord.gg/CWCj3rw","https://gitplait.tech/"],"app":"hiveblog/0.1"} |
created | 2020-06-26 12:34:03 |
last_update | 2020-06-26 12:34:03 |
depth | 1 |
children | 0 |
last_payout | 2020-07-03 12:34:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 479 |
author_reputation | 64,455,719,431 |
root_title | "CONCEPT OF METHODS IN JAVA PROGRAMMING" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,187,740 |
net_rshares | 0 |