Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+15 votes

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

asked in CSC211_Winter2018 by (8 points)

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 (8 points)