

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CSI 3471 Name ___________________________ Lab 2
1 of 2 Corrected 1/31/
Lab 2: Strings, Strings, Strings
a. What is the difference between the “==” operator and the “equals” operator?
b. In fragment A.4, which object owns the compareTo function?
c. When startsWith takes two parameters, the 2nd^ parameter represents a “position”. Is it possible for the position value to be negative?
d. Can the endsWith operation take more than one parameters? See the Java documentation.
CSI 3471 Name ___________________________ Lab 2
2 of 2 Corrected 1/31/
e. For fragment B.2: i. Explain the difference between the two different calls to regionMatches, one with four parameters and the other with five.
ii. Why does the second call return true?
f. For fragment C.2, how is lastIndexOf different from indexOf?
g. For fragment C.3, where does the indexOf start to look for a match?
h. For fragment C4, where does the lastIndexOf start to look for a match?
i. What happens when indexOf or lastIndexOf does not find a match?