Strings
- Write a line of code to use the String’s substring() method to obtain the substring "lip" from a String instance named s that is set to "tulip".
- Only + and += are overloaded for String objects
- The method substring() starts at the first index, inclusive, with 0 being the first character), and ends at the end index -1 (that is, exclusive of the end index).
- The StringBuffer class does not override equals(). Hence, the code below returns false when passed two different objects.
StringBuffer sb2 = new StringBuffer("hello");
if (sb1.equals(sb2))
Comments
Post a Comment