
Sir, can i convert StringTokenizer into String don't use String array because i want to add to JLabel component. Please give answer to me.

Hi Friend,
Try the following code:
import java.util.*;
class ConvertStringTokenizerToString
{
public static void main(String[] args){
StringTokenizer st =new StringTokenizer("Hello World");
String str="";
while (st.hasMoreElements())
{
String token = st.nextElement().toString();
str+=token+" ";
}
System.out.println(str);
}
}
Thanks
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.