How to split text in Java
I want to split the String text so that only first letter comes as output.
But its not happening. Can anyone help me please??
Class
public class textSplit {
public static void main(String[] args) {
// TODO Auto-generated method stub
String text = "abcd";
String [] letters = text.split(null);
System.out.println(letters[0]);
}
}
No comments:
Post a Comment