Question: Assuming that the following variables have been declared: String str1 = Q.E.D.; String str2 = Arcturan Megadonkey; String str3 = Sirius Cybernetics Corporation; evaluate the

Assuming that the following variables have been declared:

String str1 = "Q.E.D.";

String str2 = "Arcturan Megadonkey";

String str3 = "Sirius Cybernetics Corporation";

evaluate the following expressions:

a. str1.length()

b. str2.length()

c. str1.toLowerCase()

d. str2.toUpperCase()

e. str1.substring(2, 4)

f. str2.substring(10, 14)

g. str1.indexOf("D")

h. str1.indexOf(".")

i. str2.indexOf("donkey")

j. str3.indexOf("X")

k. str2 + str3.charAt(17)

l. str3.substring(9, str3.indexOf("e"))

m. str3.substring(7, 12)

n. str2.toLowerCase().substring(9, 13) + str3.substring(18, str3.length() – 7)

Step by Step Solution

3.40 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Results of String expression... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!