String Tokenizer

 MAIN.JAVA:

import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String usrInput = sc.nextLine();
        //StringBuilder sb = new StringBuilder(usrInput);
        String k =usrInput.replace("="," ");


        StringTokenizer st = new StringTokenizer(k, ";");
        while (st.hasMoreTokens()) {
            System.out.println(st.nextToken());
            // re.add(st.nextToken());
        }


    }
}

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.