I am new to java, As per my understanding String = "ABC" will be stored in string pool and String s=new String("ABC") will create a new memory to store the value. if my understanding is correct how to prove this without using == or equals() method? Can we prove this using hashcode ? I generated the hashcode value for both, it returns the same value... why is that...
Aucun commentaire:
Enregistrer un commentaire