+ 3

what is the method addOneTo?

7th Oct 2016, 7:54 AM
sandhyarani
sandhyarani - avatar
8 Antworten
+ 3
I think it is just showing you that x is used and passed into addoneto but not altered and returned back as x, that is why when printed x is 5 and not 6
9th Nov 2016, 10:44 PM
Mel Clarke
Mel Clarke - avatar
+ 2
It can be anything... what the method aim? Were do you use it?
10th Oct 2016, 7:30 PM
Виталий Стрельников
Виталий Стрельников - avatar
+ 2
It is like function in c/c++,in java we call it method.
19th Oct 2016, 4:12 PM
mahmud hossain
mahmud hossain - avatar
+ 2
In c or c++ language function used is main(). similarly In Java main function is called methods .
20th Oct 2016, 2:51 PM
karthikayani
+ 2
method addOneTo() is basically here a function like in c/c++, but in java we call them methods .method addOneTo(int name) is assigning the value of x in the method
13th Nov 2016, 5:43 AM
Shakti Singh
Shakti Singh - avatar
+ 1
its like same as function in c, c++. but in java its called method.
26th Nov 2016, 9:44 AM
Aminur Rahman
Aminur Rahman - avatar
0
It adds one unit to the parameter passed. if you mean this as the same function in tutorial.
6th Nov 2016, 1:28 PM
Mowlana
Mowlana - avatar
0
but what if u want the incremente value in main method?
13th Apr 2020, 3:43 PM
Simran Singh
Simran Singh - avatar