String a = "hello"; であることは知っています。「こんにちは」を文字列リテラルプールに入れます。私の質問は:
1.
String a = "hello";
String b = "hell"+"o";
文字列リテラル プールには、"hello"、"hell"、"o" の 3 つのオブジェクトがありますか?
2.
String a = "hello";
String b = new String("hello");
次に、文字列リテラルプールに「hello」オブジェクトがあり、ヒープに文字列オブジェクトがありますか?
3.
BufferedReader br = new BufferedReader(new FileReader("names"));
String line = br.readLine(); //(the value of line is "hello" now, for example)
次に、文字列リテラルプールに「hello」オブジェクトがあり、ヒープに文字列オブジェクトがありますか?