public class Test {
int i = 1;
void add(int i) {
i += i;
System.out.println(i);
}
public static void main(String args[]) {
Test t = new Test();
t.add(5);
}
}
Inside the add method, we work only with the method i parameter, since in order to access a class variable i (especially in the case of coincidence of names) "this" keyword should be used.
Login in to like
Login in to comment