Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+15 votes

while using the charAt method, can it accept both double and int as an index parameter?

asked in CSC211_Winter2018 by (1 point)

1 Answer

+9 votes

I believe that you would only be able to return an int because it is the CharAt method counts the

number of characters in the index. Therefore, I am unsure how you would be able to have something like charAt(1.5). This is becasue the index is just counting 0123456789....

Hope this helps.

answered by (1 point)
...