what is the problem of this java question? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

what is the problem of this java question?

I found the below question from the challenge quizzes. I responded dot(.) and I got WRONG :( I was very sure while responding and I checked it on a compiler and I was RIGHT. but when I check for the correct answer on the challenge it was given as "error". I don't get what the error is. Do you? public static void main(String[] args) { String a="Programming is awesome."; System.out.println(a.charAt(a.length()-1)); }

11th Jul 2017, 11:24 AM
Millo
Millo - avatar
7 Answers
+ 5
Thank you Sami Khan. I never noticed that even when I write it on a compiler. tricky quiz!
11th Jul 2017, 12:02 PM
Millo
Millo - avatar
+ 4
Okey, Here is the google drive link to the screenshot. https://drive.google.com/open?id=0Bw-oZgIQOMMwNWFaa3NSWXJDb1E
11th Jul 2017, 11:51 AM
Millo
Millo - avatar
+ 3
I have the screenshot. But how can I share it.
11th Jul 2017, 11:38 AM
Millo
Millo - avatar
+ 3
recheck the screenshot.. it is written "a.length" whereas ".length()" is the method not ".length" therefore it says as error
11th Jul 2017, 11:58 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 3
yeah it is.. 😉
11th Jul 2017, 12:02 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 2
do u have the screenshot of the challenge question? Since the answer is correct, it shouldn't be an error
11th Jul 2017, 11:27 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 2
upload it to Google drive or any cloud share and share it via link and copy the link and paste it here
11th Jul 2017, 11:42 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar