Sunday, May 4, 2014

Here's something relevant to strings in computer science?

I had a computer science test on arrays, but I failed it. Here is something relevant to strings.

String str = "Contact lenses";

System.out.println(str.length(. = 14
System.out.println(str.indexOf("lenses"… = 8
System.out.println(str.contains("L". = false
System.out.println(str.substring(2, 7. = ntact
System.out.println(str.substring(10. = nses

Are the following outputs correct?
Added (1). My bad

System.out.println(str.indexOf("lenses"… = 8

Read more: Here's something relevant to strings in computer science?