Have the following case:
class Bond {
private static int price = 5;
public boolean sell() {
if(price<10) {
price++;
return true;
} else if(price>=10) {
return false;
}
return false;
}
public static void main(String[] cash) {
new Bond().sell();
new Bond().sell();
new Bond().sell();
System.out.print(price);
Bond bond1=new Bond();
System.out.print(price);
}
}
It will print: 8 9. Will all instances that will be made, will point to the same object in the heap?