0
Explain methods in java
java
3 Respostas
+ 1
methods in Java are like functions in other languages like C++. they take parameters (or arguments), there is some code or operation on the parameter, and it may or may not return a value. if it returns a value then the
code must not be void.
+ 1
A method is a collection of statements that perform some specific task and return result to the caller. A method can perform some specific task without returning anything. Methods allow us to reuse the code without retyping the code. In Java, every method must be part of some class which is different from languages like C, C++ and Python.
Methods are time savers and help us to reuse the code without retyping the code.