No, the id parameter that was passed to the constructor will be assigned its value.
You can verify this by checking the id value after creating the object:
public static void main(String[] args) { Account a = new Account(100); System.out.println(a.id); }
It will display 0 , not 100 .
You can also see this if you make the transmitted parameter final :
public Account(final int id) { id = id; }
In this case, an error will occur during compilation:
java.lang.RuntimeException: Uncompilable source code - final parameter id may not be assigned
To assign a value to a class field in this case, use this.id :
public Account(int id) { this.id = id; }