
how can we Break a string into words without using StringTokenizer ??

The given code convert the string into words.
import java.util.*;
class StringExample
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter string:");
String str=input.nextLine();
String st[]=str.split(" ");
for(int i=0;i<st.length;i++){
System.out.println(st[i]);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.