Java charAt() Method
The charAt() method is used to return the character at the specified index. The index ranges from 0 to length() - 1.
Syntax
public char charAt(int index)
Parameters
-
index -- The index of the character.
Return Value
Returns the character at the specified index.
Example
Example
public
class
Test
{
public
static
void
main
(
String
args
[
]
)
{
String
s
=
"
www.runoob.com
"
;
char
result
=
s
.
charAt
(
6
)
;
System
.
out
.
println
(
result
)
;
}
}
The execution result of the above program is:
n
Java String class