I don't know what happens if I apply the increment operator on an expression in Java.
int ai[] = new ai[10];
ai[0]++;
// ***
class Car {
public int yearMade = 0;
}
class Person {
public Car myCar = new Car();
}
Person p = new Person();
p.myCar.yearMade++;
Can you increment an element of an array the way the first example is showing?
Can you increment a field in a class (I do know about encapsulation and getters/setters, my question is syntax-semantics oriented) the way I show in the second example?
I remember the age of C/C++. There used to be a problem with p -> x++, for example. You sometimes needed to enclose complex expressions in parentheses when using increment or decrement.
Thank you for any hints.