9496 Lynk's site for housing knowledge and information for the team.
double
, in the second its void
void
is used is when the method won’t send any data back /*add 4 to the paramter sent to the method and return the result*/
public static double addFour(double num){ // the varible type before the method name is what type will be returned
return num + 4; //return is the keyword that tells java to end the method and send the value
}
/*if the boolean named bol is true than print out the double named num*/
public static void ifTruePrint(boolean bol, double num){ //void means the method won't return any value
if (bol){
System.out.println(num);
}
} //this method doesn't return a value
addFour
has one parameter num
Return
is a java keyword that tells the program what data the method should send backvoid
you don’t have return in the method at all.