0
Why is my code making the mistake:
error: class, interface, or Enum expected
Follows the code:
import java.util.Scanner;
public class teste175 {
public static void main (String[] args) {
Scanner sc = new Scanner (System.in);
int a, i;
a = sc.nextInt();
int v[] = new int [a];
for (i=0; i<a; i++) {
v[i] = sc.nextInt();
}
funcao (v, a);
}
}
static int funcao (int v[], int a){
int temp, j, i;
for (j=0; j<a; j++){
for (i=1; i<a; i++){
if (v[i]<v[i-1] {
temp = v[i];
v[i] = v[i-1];
v[i-1] = temp;
}
}
}
return v;
}
}
A tip, add the indented code, makes it easier to read it if the problem is simple. And another, it is no use to throw the code here and wait for someone to find out where the error occurred, besides the code, preferably indented, always point out where the error occurs in the code.
– user28595