NoParameterDeclaration.invalid.mj 408 Bytes
Newer Older
1 2 3 4 5 6
/**
 * Call without Parameter to Method
 * error: variable a is already defined in method test(int)
 */
class NoParameterDeclaration {

7
    public int a;
8 9

    public static void main(String[] args) {
10 11

        NoParameterDeclaration testObj = new NoParameterDeclaration();
12 13 14 15
        /*there is no parameter given here*/
        testObj.test();
    }

16
    public void test(int i) {
17 18 19 20 21 22
        int a = i;
    }

}