Pregunta de entrevista de Deloitte

What happen if we add null in TreeSet. Give the logic.

Respuesta de la entrevista

Anónimo

10 ene 2015

can be added if the treeset is empty because there is no object to compare with but throws null pointer exception if the ts is non empty since the comparison of null with non null object ref throws nullpointer exception.

1