Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
wheaties
· 13y ago · 0 comments
I hate to break it to you but "n" is not final. Hence, you can reassign any BigInteger to it. Why not just set n = 9 and the root = 3...
Immutability is your friend. Use it or lose it.
Comments
[–]
craigching
13y ago
But n is also private, so you can't reassign it without using setAccessible or changing the security manager, both forbidden by the rules.
[–]
coolbrow
13y ago
But "n" is private and the rules state the solution must be in a different class. Thus you can't simply reassign it.
[–]
tantalor
13y ago
You can't assign anything to a private variable.