public static void main(String [] args){
String s = "java"; //1
s.concat(" SE 6"); //2
s.toLowerCase(); //3
System.out.print(s); //4
}
The answer to this question is "4". I thought it would be "3". My confusion is line 3, which creates "java" string again, but doesn't java know that the "java" string already exist in the string constant pool, so why create it again?
Aucun commentaire:
Enregistrer un commentaire