First, String is a class. Char is the primitive type.
And of course, the String is just an array of chars after all. If you look at the actual String source, use char[].
In other words, the String class is intended to make char[] more convenient.
In fact, the more important question is the difference between String a = "abcde"; and String a = new String ("abcde").
In jvm, there is a space called constant pool.
The string is also stored there, and I expected it when it was created as newIt's created in the Shipy Hip.
In other words, objects that are generated as new and that are generated as literal are stored elsewhere.
More precisely, the permanent area. Sometimes, when you run Java programs with many classes such as Eclipse, you may have seen that you are not able to perform it even though you say that you don't have enough permgen memory.
© 2024 OneMinuteCode. All rights reserved.