Java. Quiz. Bad wording. Fill in the blanks to output 4th character of the String "a". | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java. Quiz. Bad wording. Fill in the blanks to output 4th character of the String "a".

Fill in the blanks to uotput 4th character of the String "a". System.out(_.charAt(_)); The right answer is System.out(a.charAt(3)); and it's easy to guess but it doesn't mean that the wording of this questioon is right. String "a" while "a" is written like this (like literal) can be assigned to any variable, i.e. b, x, z... (String b = "a";) (I've even reported this question as "Wrong question" even if I answered right, am I right? ☺)

8th Aug 2017, 10:09 AM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
2 Answers
+ 1
The situation is pretty ambiguous here until we introduce a thing called context. In the linguistic sense, double quotes simply refer to a particular named object or thing whereas in the programming sense (i.e. Java), the double quotes obviously refer to a String literal. Now putting that statement into context, the author of the quiz was pretty much obviously referring to the former. Hope I cleared it up ☺
9th Aug 2017, 6:32 AM
Garikai
Garikai - avatar
0
@Garical Thank you, but if you reread my "question", I said that I had no problem guessing that "a" is really a variable name. But I wan't SL to be as perfect as it's possible... :-) Upd: and in literature I usually see particular named variables written/typed without double quotes... btw, consistency is another entity I wan't to be added to Sololearn's courses/materials/question/answers/quizzes (we have different indentations, different coding standarts/conventions/styles e t.c.)
9th Aug 2017, 8:08 AM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar