In: Computer Science
Assume that the following variables have been declared:
String a = “Ready, Set, Go!”;
String b = a.substring(5, 10);
char b1 = b.charAt(2);
Evaluate the following expression:
1. Character.isLowerCase(b1)
2. b1 + 5
3. b + 5
4. Character.toLowerCase(b1)
5. a.charAt(2 + a.indexOf(“e”))
a = "Ready, Set, Go!"
b starts from 5 till 9
so b=", Set"
b1 is character in b at index 2,
so b="S"
1. Character.isLowerCase(b1)
This returns false is b is upper case("S")
2. b1 + 5
This will add 5 to the ascii value of character in b1
the ascii value of S is 83, so this returns 88.
3. b+5
This will simply append 5 at the end of string b
this returns ", Set5"
4. Character.toLowerCase(b1)
This converts S to s and returns s
5. a.charAt(2 + a.indexOf(“e”))
a.indexOf("e") returns 1
a.charAt(2+1) return d