+ 1
what is method?
2 odpowiedzi
+ 3
method is a collection of statements to perform an operations.
we use methods to divide code to small chunks. benefits of that is the methods makes the code is easy to follow and easy to debugging by sperate the code. Other benefit of the method that we can reuse the code. becase the method write once and we can use it many times. hopefully what I said is useful
+ 1
Method is a function inside class.
class A{
public int method() {
//... some code...
}
}
int function() {
//... some code...
}