StringTokenizer and Scanner and String.Split

Asked 2 years ago, Updated 2 years ago, 164 views

scanner of Java class to learn the difference between the three, and stringtokenizer split wondered. I know, separate Then why bother to work only in the strings only with split stringtokenizer scanner when do they use?

split java java.util.scanner tokenizer

2022-09-22 10:45

1 Answers

For now, the regular expression function has been added to the String class. In addition, J2SE 5.0 JavaDocs does not recommend further use of StringTokenizer.

 StringTokenizer is not recommended for new code 
  Inheritance class held for compatibility reasons. The user who wants to use this feature is: 
  It is recommended to use the detach method of the String or the java.util.regex package. 

These are the characteristics of the classes used for string separation, and StringTokenizer is no longer recommended, and if there is a reason to use Scanner for the same string separation, If you're using Scanner, it's useful if you want to separate strings while reading data from a file.


2022-09-22 10:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.