Can anyone help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can anyone help me?

we had an assignment about "how to declare a method in java" can anyone help me about it tnx in advance

28th Jan 2018, 12:24 PM
Janallen Lim
Janallen Lim - avatar
9 Answers
28th Jan 2018, 12:51 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
public void makeTea(){}
28th Jan 2018, 12:31 PM
Maxim
Maxim - avatar
28th Jan 2018, 1:33 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 4
What's wrong?
28th Jan 2018, 12:40 PM
Maxim
Maxim - avatar
+ 3
:'(
28th Jan 2018, 12:36 PM
Janallen Lim
Janallen Lim - avatar
+ 3
yep thats how i would declare a method exactly like this public static int method(int i, int j){ //Statments; return i j ;} /* Method is accessible to all classes "public" Method does not need an instance "Static" Method return type "interger" Method returns */
28th Jan 2018, 1:42 PM
D_Stark
D_Stark - avatar
+ 2
cant find it on the internet 😑 really needed the step by step. :(
28th Jan 2018, 12:42 PM
Janallen Lim
Janallen Lim - avatar
+ 2
public static int method(int i, int j){//Do Somthing} ?
28th Jan 2018, 12:52 PM
D_Stark
D_Stark - avatar
+ 2
definitely @D_Stark
28th Jan 2018, 12:55 PM
Janallen Lim
Janallen Lim - avatar