Не уверен, что вы хотите, но по крайней мере это компилируется. Возвращает максимум массива или -1, если массив пустой / нулевой.
Не уверен, ищете ли вы этот или отсортированный массив.
Как сказал Слав, большинство проблем заключалось в синтаксисе и несоответствии между int [] и int.
interface myFunc{
int func(int n[]);
}
class bubbleSort {
int bubble(int n[]){
// int result = 0;
if(n == null || n.length == 0){
return -1;
}
for(int j=0;j<n.length;j++){
for(int i=j+1;i<n.length;i++){
if(n[i] > n[j]){
int t = n[j];
n[j] = n[i];
n[i] = t;
// result = t; // You dont need this... i think...
}
}
}
return n[0];
}
}
class test {
public static int lista(myFunc mf, int[] n){
return mf.func(n);
}
public static void main(String[] args) {
int intInt[] = {4,3,1,20,3,6,10};
int intOut;
bubbleSort sort = new bubbleSort();
intOut = lista(sort::bubble, intInt);
System.out.println(intOut);
}
}