1

I was experimenting with char arrays and integers, when I found something that confused me a lot. In Java, if you type the following code:

String inputs = "123";
char[] inputs2 = inputs.toCharArray(); // Turn String into Char Array
int a = inputs2[0];

println(a);

I would have expected for "a" to return 1 because 1 is the first element in the array. However, it returned 49. Why does this occur? Is there any way to get around this issue?

Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42

0 Answers0