+ 12
What is the need of using functions??
4 Answers
+ 12
Well methods(or functions as you call them) are fundamental in java, every code must have at least one method(the main method)
Methods are a collection of statements that perform a particular task, they are useful mostly because they can be reused
+ 19
suppose u want to use a method getResult () multiple times at different or same sections of the code ,
will u write the full algorithm of that method getResult() again and again at different places ... wouldn't it be tedious & waste your time also ? ... even if u copy & paste then it will increase code size
it would be smart to make a {function/method getResult ()}definition only once & use it just in different sections of code by method call
//hope it helpsāŗ
+ 8
thanks for your repliesššš
- 3
B:hhghgBn;buggy njhhuyjhijhjhBtFbTG