Created
October 12, 2015 15:47
-
-
Save dheshanm/a1749ebeb039dded089e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package tutorials.Next; | |
| import java.io.*; | |
| import java.util.*; | |
| /** | |
| * Created by Dheshan M (@D-codex) on 10/12/2015. | |
| */ | |
| public class StringTokens { | |
| public static void main(String Args[]){ | |
| int n=0; | |
| Scanner in=new Scanner(System.in); | |
| System.out.print("Enter a String :"); | |
| String str=in.nextLine(); | |
| StringTokenizer st=new StringTokenizer(str); | |
| while(st.hasMoreTokens()){ | |
| System.out.println(st.nextToken()); | |
| n=n+1; | |
| } | |
| System.out.print("The Entered String has "+n+" Tokens"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment