Re: Newbie String Questions



I am not sure why there is a constructor, probably a relic from the
ealier versions of java.

I have never used a constructor for strings.

As for the .concat() method I would say the same thing.


On Nov 28, 2:50 pm, "Dom" <dolivas...@xxxxxxxxx> wrote:
Anyone have some time to answer simple String questions?

1. Why is there a String (String) constructor? Is there any
difference between these statements:
a) -- String s = new String ("ABC");
b) -- String s = "ABC";

2. Why is there a concat method? Is there any difference between
these statements:
a) -- s = s.concat ("ABC");
b) -- s = s + "ABC";

TIA,
Dom

.



Relevant Pages

  • Re: a method to make js have the ability to inherit
    ... but without the implied type-conversion of the string ... that uses the name of a specific constructor. ... programmer has no idea at all what types of object they are ... no reason for ever doing so. ...
    (comp.lang.javascript)
  • Re: Newbie question: Writing your own class
    ... is made by a class's Create constructor method which allocates memory ... FDefinition: string; ... every other descendant of TObject ... Result:= FDefinition; ...
    (comp.lang.pascal.delphi.misc)
  • Re: About speed
    ... property Name: String read fName; ... constructor TProperty.Create; ... fValue: PropertyOfT_DataType; ... constructor Create(other: TPropertyOfT); overload; ...
    (borland.public.delphi.non-technical)
  • Re: a method to make js have the ability to inherit
    ... discriminating but without the implied type-conversion of the string ... makes no use of an object's - constructor - property anyway.) ... programs should serve some known purpose known to the programmer. ... var o = Father.prototype; ...
    (comp.lang.javascript)
  • Re: regex into str
    ... people confronted with it to reject python as language. ... Don't get me wrong - there is a lot of decisions to be made in language ... The only thing you really need is a simple constructor for your undoubtly ... Overloading "" as the string ...
    (comp.lang.python)