MainProject.java

阅读更多
package cn.com.main;

import java.io.IOException;
import java.util.StringTokenizer;

public class MainProject {



/**
* @param args
*/
public static void main(String[] args) {
String str="AAAA;BBBB;CCCC;DDDD;EEEE;FFFF;GGGG";
int count = 0;
    StringTokenizer tokens = new StringTokenizer(str,";");
    while (tokens.hasMoreTokens()){
    count++;
    System.out.println(tokens.nextToken());
    System.out.println(count);
    }
  
}
}

你可能感兴趣的:(Java)