Java StringTokenizer example - Java Language Basics

Java examples for Language Basics:StringTokenizer

Introduction

Use StringTokenizer to break a string into tokens.

Demo Code

 
import java.util.StringTokenizer;
 
public class Main {
 
  public static void main(String[] args) {
    StringTokenizer st = new StringTokenizer("Java StringTokenizer Example");
   //from ww  w .  ja  va 2 s.co  m
    while(st.hasMoreTokens())
      System.out.println(st.nextToken());
   
  }
}

Result


Related Tutorials