What is the value in the variables x, y, and z after the following statements execute (assume each variable below has already been declared)?

str = "the Bluenose in the sun";
x = str.substring(4, str.indexOf("in"));
y = x.length();
z = x.charAt(4);

find the answers for the questions below:
Value of x:
Value of y:
Value of z:

4 answers

read the documentation of str.substring, and things should be clear.
Remember that strings are indexed starting at zero.
There are lots of examples online. See what you come up with.
for x, i got: Bluenose
for y, i got: 9
for z, i got: 110

my assignment says that x, y and z is wrong. but i copied it this java program in my java editor and and it gave x = Bluenose, y =9 and z= 110
for x, you will also get the trailing space
y is correct, oddly enough, since the length of "Bluenose" is only 8.
z is a char, not an int
thanks oobleck
Similar Questions
    1. answers icon 1 answer
    1. answers icon 1 answer
    1. answers icon 1 answer
  1. What does SEE IT stand for?See, Evaluate, and Execute in Time Search, Execute, and Enjoy in Texas Search, Evaluate, and Execute
    1. answers icon 1 answer
more similar questions