Assuming that the following variables have been declared: String str1 = Q.E.D.; String str2 = Arcturan Megadonkey;
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 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)
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted: