About String a = "123" and string a = new string ("123")
Since starting contacting Java, I feel the difference between definition string a = "123" and string a = new string ("123"), I don't understand the difference between them. Ask the master, I will understand what is the reason for public class test {public Static void main (string args []) {string S1 = "hello"; string s2 = "hello"; string s3 = new string ("hello"); system.out.println (S1 == S2); system.out .println (S1 == S3);}} The value returned is Truefalse master, string s = ""; virtual machine has a String instance. String s = new string (""); there is two. I always feel that this is a hidden vulnerability. In the future, I can't find an error in the process of this problem because of this problem.
About the array of Length
I learned to IO today, I was confused, and a simple code saw a lot of questions that I didn't understand.
First record the problem about array length and length ()
According to people in the Java group, Length is attribute (used by group) Length () is a method (array member)
E.g:
String [] ss = {"1", "22", "333", "4444"}
ss.length // is 4
SS [0] .length () // is 1
SS [2] .length () // is 3