-1

If I have

Character.isDigit('53')

I get error

but if I have:

Character.isDigit('5')

I get a boolean value of TRUE.

Why is that so?

Hiep
  • 109
  • 1
  • 2
  • 6

3 Answers3

3

'5' is a character. '53' is not a character.

Or, to look at it in terms of strings, "5" is a string with one character in it ('5'), and "53" is a string with two characters in it ('5', '3').

C. K. Young
  • 219,335
  • 46
  • 382
  • 435
0

A character is a single symbol. This means that '5' is a character, but since '53' has two symbols, it is not a character.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
0

'5' and '53' both represent as a string where first contain a character and second contain two character.

Moni
  • 433
  • 3
  • 9