CoFfEE/SteakKnife

index help

'(' expected

The Java compiler is expecting an opening parenthesis (the "(" character).

Take a look at the following example:

public class OBExpected{
        public void mefod{

        }
}
Attempting to compile this with the following command:
javac OBExpected.java
Gives us the following output:

docs/gcj_errors/OBExpected.java:2: '(' expected
        public void mefod{
                         ^
1 error
All methods must have a list of parameters, enclosed in parenthesis, even if that list is empty. The following class demonstrates some legal method declarations:
public class ExampleMethods{

	public void aMethod(String v1, double a2, int foobar){
		//some code
	}
	
	public int addValues(int val1, int val2){
		return val1+val2;
	}

	public void iHaveNoParams(){
		//some code
	}	

	public String neitherDoI(){
		return "Some text";
	}
}
So, our problem is easily fixed by adding a parameter list to the method "mefod". We'll assume that we didn't need any parameters, so the parameter list is empty. Here is the fixed code:
public class OBExpected{
        public void mefod(){

        }
}

For an explanation of highlighting, click here