create account

CONCEPT OF METHODS IN JAVA PROGRAMMING by leoumesh

View this thread on: hive.blogpeakd.comecency.com
· @leoumesh ·
$5.28
CONCEPT OF METHODS IN JAVA PROGRAMMING
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>
![Screenshot_1.png](https://images.hive.blog/DQmZwUqTSTJP3PkgoxXEc8iM4NrD24CuvGgaNuKKTSpPK5f/Screenshot_1.png)
</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.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorleoumesh
permlinkconcept-of-methods-in-java-programming
categoryhive-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"}
created2020-06-26 07:21:33
last_update2020-06-26 07:21:33
depth0
children3
last_payout2020-07-03 07:21:33
cashout_time1969-12-31 23:59:59
total_payout_value2.856 HBD
curator_payout_value2.422 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,264
author_reputation212,340,493,251,438
root_title"CONCEPT OF METHODS IN JAVA PROGRAMMING"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,184,148
net_rshares15,749,648,825,853
author_curate_reward""
vote details (34)
@chrisamuda ·
I think I need this
properties (22)
authorchrisamuda
permlinkqclcau
categoryhive-122108
json_metadata{"app":"hiveblog/0.1"}
created2020-06-27 15:28:09
last_update2020-06-27 15:28:09
depth1
children1
last_payout2020-07-04 15:28:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length19
author_reputation17,040,057,630,088
root_title"CONCEPT OF METHODS IN JAVA PROGRAMMING"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,207,890
net_rshares0
@leoumesh ·
You are in the perfect place then I am just a beginner🙂
properties (22)
authorleoumesh
permlinkqcmml3
categoryhive-122108
json_metadata{"app":"hiveblog/0.1"}
created2020-06-28 08:07:57
last_update2020-06-28 08:07:57
depth2
children0
last_payout2020-07-05 08:07:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation212,340,493,251,438
root_title"CONCEPT OF METHODS IN JAVA PROGRAMMING"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,219,081
net_rshares0
@gitplait-mod1 ·
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/)
properties (22)
authorgitplait-mod1
permlinkqcj9kq
categoryhive-122108
json_metadata{"users":["gitplait"],"links":["https://hive.blog/trending/hive-103590","https://discord.gg/CWCj3rw","https://gitplait.tech/"],"app":"hiveblog/0.1"}
created2020-06-26 12:34:03
last_update2020-06-26 12:34:03
depth1
children0
last_payout2020-07-03 12:34:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length479
author_reputation64,455,719,431
root_title"CONCEPT OF METHODS IN JAVA PROGRAMMING"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,187,740
net_rshares0