File I/O
Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
/*
Author:ZT
Date : Sep 9,2017
Purpose: Developing java Application
Reference: Java 2 SE
http:// www.Oracle.com
*/
package a.b.c;
import javax.swing.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Appl01 extends JFrame implements ActionListener{
Appl01(){
/*
int content;
while ((content = fis.read()) != -1) {
// convert to char and display it
System.out.print((char) content);
}
*/
} // Constructor
public static void main(String str[]) throws Exception {
String yourname=JOptionPane.showInputDialog(null,"Enter Your Name");
JOptionPane.showMessageDialog(null,yourname);
File f1=new File("B.txt");
FileOutputStream fos=new FileOutputStream(f1);
PrintWriter out=new PrintWriter(fos);
out.println(yourname);
out.close();
//
File fi=new File("BB.txt");
FileInputStream fis=new FileInputStream(fi);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
/*
int content; //Read Charater by Charecter
while ((content = fis.read()) != -1) {
// convert to char and display it
System.out.print((char) content);
}
fis.close();
*/
} // end of main()
public void actionPerformed(ActionEvent ae){
String result=ae.getActionCommand();
} // end of method actionPerformed()
} // End of class Appl01