Question
In java Find the StringTokenizer class in the Java API documentation. Run the example code I wrote on using the StringTokenizer. Watch
In java
• Find the StringTokenizer class in the Java API documentation.
• Run the example code I wrote on using the StringTokenizer.
• Watch the video I posted on using the StringTokenizer.
• Code all this in one class with only the main( ) method.
• Create a project in BlueJ to accomplish the following tasks. You only need to write a Driver with the main( ) method.
For each of the following 1-4 read a new line of text from the keyboard.
1) Read in a line of text from the keyboard that uses the space as the token delimiter.
Create an instance of the StringTokenizer using the line of text and the space as a delimiter.
Print how many tokens are in the line.
Print each token.
2) Create an instance of the StringTokenizer using a new line of text that uses a comma as a delimiter
Print how many tokens are in the line.
Print each token.
3) Create an instance of the StringTokenizer using a new line of text. Use comma as the delimiter and count the delimiters as a token.
Print how many tokens are in the line.
Print each token.
4 Create an instance of the StringTokenizer using a new line of text and more than one delimiter
Print how many tokens are in the line.
Print each token.
5) Create a text file with at least five lines of text that has values for a Student, one per line where each
value is separated by a comma.
Example: Sara,Rustoff,8001233323,65,3.4
Use a comma as a delimiter (not a space). and
Read the file line bt line and for each line you read, create a StringTokenizer and print each token.
Sample output:
Sara
Rustoff
800123323
65
3.4
Step by Step Solution
3.54 Rating (151 Votes )
There are 3 Steps involved in it
Step: 1
import javautil import javaio public class StringTokenizerDemo public static void mainString args sp...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started