+ 1

Can anyone tell me the output of this question?

String a="String"; System.out.print("a".length());

30th Dec 2020, 11:59 AM
Atul [Inactive]
8 Antworten
+ 4
Atul Panda May be you are mistaken..can you show the screenshot of that question..?
30th Dec 2020, 12:59 PM
NavyaSri
NavyaSri - avatar
+ 2
1 Because the a is enclosed in double quotes so now it acts as a string and not reffering to the variable a.
30th Dec 2020, 1:07 PM
Krish
Krish - avatar
+ 2
Sorry but in the question it was given "mystr" Sorry to distrub you all for my negligence 😞😭
30th Dec 2020, 1:30 PM
Atul [Inactive]
+ 1
1 becose "a" is a String with lenght 1 becose a is a variable with type as String and lenght 6
30th Dec 2020, 12:08 PM
Иван Чикyнов
Иван Чикyнов - avatar
0
The answer is 5. I got this question from a challenge at sololearn and it is showing 5 as the answer
30th Dec 2020, 12:13 PM
Atul [Inactive]
30th Dec 2020, 1:27 PM
Atul [Inactive]