String construtors and instanciation
in
Programming Questions
•
2 years ago
Hi,
Well that's more a java question rather than a processing one.
But i just realize that's something i've never figured out.
My question is what's the difference between:
As far as i understood, String variables are composite, instantiate objects from String class.
The difference would be that using String constructor create a new Object.
So :
If someone could clarify this (What's the diff ? What for ?...).
Thanks.
Well that's more a java question rather than a processing one.
But i just realize that's something i've never figured out.
My question is what's the difference between:
- String s = "processing";
- String s = new String("processing");
As far as i understood, String variables are composite, instantiate objects from String class.
The difference would be that using String constructor create a new Object.
So :
- String s1 = "processing";
- String s2 = "2010";
- String s1 = new String("processing");
- String s2 = new String("2010");
If someone could clarify this (What's the diff ? What for ?...).
Thanks.
1