Questions tagged [charat]

The charAt() method is used to provide a single character by its index within a string.

The charAt() method is used to provide a single character by its index within a string.

292 questions
-4
votes
1 answer

Does String's charAt() method ever return a negative integer value in Java?

String data = //some String; int val = data.charAt(2); Can val ever have a negative value in any scenario?
aquesh
  • 9
  • 1
  • 1
  • 8
-4
votes
1 answer

How does this Java snippet work?

I am studying Java as a beginner, but I did not understand this script. I have a 'look and say' assignement. Can anyone tell me how this is working? public class App { public static void main(String[] args) { for (int k = 0, len =…
-4
votes
1 answer

How to reverse strings in js without using methods

Without using the split reverse and join functions, how would one do such a thing? The Problem Given: Reverse the words in a string Sample Input: "Hello World" Sample Output: "World Hello"