Sunday, 17 July 2016

Java Code Showing Use of String Tokenizer

String Tokenizer belongs to Util Package. And it is use to break String using delimiter such as space , comma(,) , slace either forward(/) or backword(\) or you can use any special symbol or character. 



public class StringTokenizerExample {

public static void main(String[] args) throws IOException{

String str="India is a Great Country.";
StringTokenizer token = new StringTokenizer(str, " ");
while(token.hasMoreTokens()){
System.out.println(token.nextToken());
}
}
}

No comments:

Post a Comment