Code:
import java.io.*;
import javax.swing.JOptionPane;
public class read {
public static void main(String args[])throws IOException
{
try{
FileInputStream fstream = new FileInputStream("C:/Users/sushan/Desktop/abb.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
String text="";
text=text+strLine;
String[] words=text.split(" ");
for(int i=0;i<words.length;i++)
{
String st=words[i]+words[i+1];
System.out.println (st);
}
in.close();}
}catch (Exception e){
JOptionPane.showMessageDialog(null,"Error");
}
}
}
Comment