package ifstatements;
public class IfStatements {
public static void main(String[] args) {
System.out.println(max(3, 40, 5));
}
public tatic int max(int num1, int num2, int num3) {
if(num1 >= num2 && num1 >= num3){
return num1;
}else if (num2 >= num1 && num2 >= num3){
return num2;
}else{
return num3;
}
}
}
The compiler keeps telling me that the line:
public tatic int max(int num1, int num2, int num3) {
expects an identifier, like this:
<identifier> expected
I tried restarting the code (copy and paste it onto a new project) but the same problem persists. Also the line
System.out.println(max(3, 40, 5));
gives me this error: "non-static method max(int, int, int) cannot be referenced from a static context"
Aucun commentaire:
Enregistrer un commentaire