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.
12 Answers
+ 5
a.charAt(3)
+ 5
Maybe the string is called a and a is something like a = "SoloLearn"
+ 5
Come on dude, what's the logic behind that. Find the 4th character from a string of length 1 lol?
+ 4
idk lol
+ 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.
0
what will be output of this ? Dont you think its "array index outof bound" exception
0
đđ€
0
nope i am 100% sure. i have encountered twice.
0
maybe the question is wrong .
0
lol ... i am asking the same question.
0
just go through the challange section several time and maybe you will get it
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");
}