First one will search the String literal "Test" in the String pool, if it is present then s will refer that and will not create new one. and creates new object only when "Test" literal is not there.
but in the second case it will create an another object without bothering much about whether it is present or not.