Convert java program to a text file


Discuss the below:

Q: Convert the program to this text to allow the program to print out each word of the input sentence to a separate line of a file called words.txt. After this, create another program that could be used to take the words in words.txt and recreate the original sentence - this time printing the result to the screen. Please write well commented code.

import jaya.io.*;

import java util *;
class Tokens{
static BufferedReader keyboard = near
BufferedRealer(new InputStrearnReader(System in));
public static void main (String [1 args) throws I0Exception{

StringTokenizer data;
System out.println("Enter your s enten c e:"); String th eSentence = keybo ard.readLineQ;
data = new StringTokenizer (th eSentence);
System out plinth ('No of words = " + data countTo kens 0);

}

}

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Convert java program to a text file
Reference No:- TGS01935599

Now Priced at $25 (50% Discount)

Recommended (97%)

Rated (4.9/5)