0

Find the 4th character of String "a" using charAt()

I dont what is the answer maybe its wrong i dont know . I found this question in this app during a challange.

19th Jan 2017, 2:25 PM
Suprakash Pal
Suprakash Pal - avatar
12 Answers
+ 5
a.charAt(3)
19th Jan 2017, 2:29 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 5
Maybe the string is called a and a is something like a = "SoloLearn"
19th Jan 2017, 2:39 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 5
Come on dude, what's the logic behind that. Find the 4th character from a string of length 1 lol?
19th Jan 2017, 2:42 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 4
idk lol
19th Jan 2017, 2:34 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
'a' is assumed as a string and 4rth character is to be picked. and i I think the fourth character is a.charAt(3); // since the index starts from 0.
19th Jan 2017, 7:02 PM
WONDE-TOM
WONDE-TOM - avatar
0
what will be output of this ? Dont you think its "array index outof bound" exception
19th Jan 2017, 2:33 PM
Suprakash Pal
Suprakash Pal - avatar
0
đŸ˜’đŸ€”
19th Jan 2017, 2:38 PM
Suprakash Pal
Suprakash Pal - avatar
0
nope i am 100% sure. i have encountered twice.
19th Jan 2017, 2:42 PM
Suprakash Pal
Suprakash Pal - avatar
0
maybe the question is wrong .
19th Jan 2017, 2:42 PM
Suprakash Pal
Suprakash Pal - avatar
0
lol ... i am asking the same question.
19th Jan 2017, 2:44 PM
Suprakash Pal
Suprakash Pal - avatar
0
just go through the challange section several time and maybe you will get it
19th Jan 2017, 2:46 PM
Suprakash Pal
Suprakash Pal - avatar
0
string x="anystring"; if(x.length()>4){ system.out.println("a character at index 4 is:"+charAt(4)); }else{ system.out.println("invalid string length"); }
28th Mar 2017, 3:24 PM
WONDE-TOM
WONDE-TOM - avatar