Character Extraction:
1) charAt()
charAt() method is used to extract single character from String.Here is a small program to demonstrate chatAt() method.
package stringdemo;
public class NewClass {
public static void main(String[] args) {
String ch="java";
System.out.println(ch.charAt(1));
}
}
The output of this program is as:
a
0 comments:
Post a Comment