Java Array Assignment Output Behaves Differently For Two Code

Java Array Assignment Output Behaves Differently For Two Code