Saturday, May 30, 2009

Java Riddle

I change the value of a constant in one file, and it causes a compile error in a different file. How is this possible?

2 comments:

Roy van de Water said...

Constants are replaced by their values at compile time. If a java object has a Constant attribute, and the other class tries to divide by it, you should get a compile error if your constant is 0.

thejoshwolfe said...

good answer, although dividing by zero doesn't cause a compile error.