0
what's wrong with my method declaration
public class blah2 { public static void main (String args[]) { double kaka(int [] yo) { double res=0; for (int i = 0; i<yo.length; i++) { res += yo[i] ; double fina = res/4; return fina; } } double num[] = {43.4, 435.55, 65.54}; double sitcom = kaka(num[]);
2 odpowiedzi
+ 2
1. methods must be defined within classes, but not within other methods
2. when calling kaka, actually when passing an Array you must not add the brackets ... so rewrite it to kaka(num)
0
thanks alot. i was scratching my head on it since last half hour