I have a custom object that has a single value of type int that I wanting to do processing on to keep this value in a set range. My question is this: Given the following cla
If you mean:
foo x = new foo();
x = 10; // This is meant to set x.bar
then no, you can't do that in Java. Good thing too, if you ask me... it would be horrible in terms of readability.
You also can't change it to allow:
foo x = 10;
as equivalent to:
foo x = new foo();
x.bar = 10; // Or x.setBar(10);