I was looking to check what is the default value for a boolean in Java. This was asked several times:
Both of those are closed as a duplicate of:
Why is Java's default value for Boolean set to true?
The second one shows two duplicate targets, one of them being the first question.
The choice of the duplicate target doesn't seem good to me. The question is confusing, it starts with some assumption which is not true, and it does not show the specific code.
The questions asks:
Why does
private Boolean shouldDropTables
; assigntrue
by default to the variable instead ofNULL
... which it does not, unless there is some more code. The OP even does not tell why he/she thinks the value is true
. Perhaps he has seen it in the debugger. Perhaps it has failed a test shouldDropTables == false
... how can one guess?
When seeing this, I would immediately close it as "Questions seeking debugging help ("why isn't this code working?") ..."
I think a question simple and basic like this (default Boolean value in Java) would deserve a good canonical answer.
How can this be fixed? I could vote to close the current duplicate target and to reopen the questions linking to it, once reopened the vote to close one of them as a dupe of the other, but I am not sure if this is a right way to proceed.