0

Still not sure what method is .. i need a simple explanation ?

17th Jul 2016, 1:24 PM
Trust Ugochukwu
Trust Ugochukwu - avatar
4 Answers
+ 6
method is function which belongs to class. Function is a part of code which you can call when you need it. For example: lets say that you have class called "MagicNumber" which contain random int value and three methods. You can check if number is lower, or higher, or equal 0 if (MagicNumber.value > 0 ){ MagicNumber.behaveWhenHigher() } else if (MagicNumber.value < 0 ){ MagicNumber.behaveWhenLower() } else { MagicNumber.behaveWhenZero() } I hope it can help you ;) cheers
17th Jul 2016, 7:44 PM
Lukasz Oswald
+ 1
method is another name for function in java and it simply defines how are our requirements can be fulfilled by writing some instructions.
8th Aug 2016, 2:01 PM
Ambika Arora
Ambika Arora - avatar
0
a method is an instruction or set of instructions to run.
19th Jul 2016, 9:56 PM
S D
0
Method in java is similar to functions in c++.
29th Jul 2016, 2:40 PM
Rohith