public static void main (String args[]) {
Scanner myinput=new Scanner(System.in) ; //Arrary length comes from user!
System.out.println("Enter a number: ") ;
int sayi=myinput.nextInt() ;
int [] Array = new int [sayi] ;
for(int i=0; i<SayiDizisi.length ; i++){ //Fill the array!(Comes from user)
System.out.println("Enter the numbers: ") ;
SayiDizisi[i]=myinput.nextInt() ;}
}
Max(int [] SayiDizisi) ; // ???????????????????????????????????
}
public static int Max(int [] Array1) {
int max=SayiDizisi1[0] ;
for(int i=0; i<SayiDizisi1.length ; i++) {
if(SayiDizisi1[i]>max)
max=SayiDizisi1[i] ;
}
return SayiDizisi ; //?????????????????????
}
}
public static void main (String args[]) { Scanner myinput=new Scanner(System.in) ; //Arrary length comes
Share
For a start, you should not have the
int []type in the method call. Change:to:
Secondly, your
Maxfunction is expected to return an integer but it’s returning an array of integers. Change its return statement from:to:
Thirdly, I can’t see where
SayiDizisiis defined anywhere. You appear to be creating an array to be populated but you’ve called itArray. Change:to:
Finally, your braces are not balanced. See the line
SayiDizisi[i]=myinput.nextInt() ;}– it has a superfluous brace at the end which causes the compiler to misunderstand your intent.Here’s a fully functioning one with those fixes made, and some comments added for your education: